Floating point to fixed point conversion

ABSTRACT

A binary logic circuit converts a number in floating point format having an exponent E of ew bits, an exponent bias B given by B = 2ew-1 - 1, and a significand comprising a mantissa M of mw bits into a fixed point format with an integer width of iw bits and a fractional width of fw bits. The circuit includes a shifter operable to receive a significand input comprising a contiguous set of the most significant bits of the significand and configured to left-shift the significand input by a number of bits equal to the value represented by k least significant bits of the exponent to generate a shifter output, wherein min{(ew - 1), bitwidth(iw - 2 - sy)} ≤ k ≤ (ew - 1) where sy = 1 for a signed floating point number and sy = 0 for an unsigned floating point number, and a multiplexer coupled to the shifter and configured to: receive an input comprising a contiguous set of bits of the shifter output; and output the input if the most significant bit of the exponent is equal to one.

CROSS-REFERENCE TO RELATED APPLICATIONS AND CLAIM OF PRIORITY

This application is a continuation under 35 U.S.C. 120 of copendingApplication Serial No. 17/141,284 filed Jan. 5, 2021, now U.S. Pat. No.11,573,766, which is a continuation of prior Application Serial No.16/876,402 filed May 18, 2020, now U.S. Pat. No. 10,884,702, which is acontinuation of prior Application Serial No. 16/734,317 filed Jan. 4,2020, now U.S. Pat. No. 10,691,411, which is a continuation of priorApplication Serial No. 15/935,313 filed Mar. 26, 2018, now U.S. Pat. No.10,558,428, which claims foreign priority under 35 U.S.C. 119 fromUnited Kingdom Application No. 1704748.1 filed Mar. 24, 2017.

This invention relates to a binary logic circuit for converting a numberfrom a floating point format to a fixed point format. In particular,certain aspects relate to circuitry that shifts the mantissa of afloating point number to convert the number to a fixed point format.

BACKGROUND

One way to represent numerical values is in floating point format.Floating point numbers are widely used within the field of computing dueto their ability to represent a wide range of values with relatively fewbits. A floating point number may be represented using binary bits. Aschematic illustration of a binary floating point number is shown inFIG. 1 . The floating point number comprises a sign field S (101),mantissa field M (105) and exponent field E (103). The sign fieldcomprises a single sign bit. If the floating point number is an unsignednumber, it may not comprise a sign field. The exponent field E comprisesa set of ew bits.

The mantissa has a bit width of mw bits and forms part of thesignificand. The significand is given by the value Y.M, where Y is theleading bit of the significand and can either be ‘1’ or ‘0’. When Y=1the significand is referred to as ‘normal’ and when Y=0 the significandis referred to as denormal. For a given implementation, the value of theleading bit is typically fixed and can be referred to as an implicitbit. As such, only the mantissa M may be stored.

The sign bit denotes the sign of the floating point number. The exponentmay either be a signed integer (typically in the range -2^(ew-1) ≤ E ≤2^(ew-1) - 1, where ew is the number of exponent bits, or exponentwidth), or an unsigned integer (typically in the range 0 ≤ E ≤ 2^(ew)-1). If the exponent is an unsigned integer, it is biased by an exponentbias B to give the ‘true’ exponent that determines the value of thefloating point number.

Thus, in general, the value represented by a floating point number isgiven by (-1)^(sign) × 2^(E-B) × significand = (-1)^(sign) × 2^(E-B) ×Y.M

Biasing the exponent allows the ‘true’ exponent (i.e. E-B) to be anegative or a positive integer whilst limiting the value in the exponentfield E to an integer greater than or equal to zero. This isadvantageous because it enables the relative sizes of exponents fordifferent floating point numbers to be compared more easily than if thevalue in the exponent field was a signed integer.

Another way to represent numerical values is in a fixed pointrepresentation. In a fixed point representation the radix point (thepoint between the integer and fractional bits of the number) is at afixed position in the numeral. This is in contrast to a floating pointnumber, in which the radix point can move, or “float”. A schematicillustration of a binary fixed point number is shown in FIG. 2 . Thefixed point number comprises an integer part 201 and a fractional part203. The integer part and fractional part are separated by the radixpoint 205. The number of bits forming the integer part may be referredto as the integer width iw, and the number of bits forming thefractional part may be referred to as the fractional width fw. For afixed point format with a given bitwidth, the number of bits used torepresent the integer part (and therefore the fractional part) is fixed.

It is often desirable to convert a number between floating point andfixed point formats. For example, it may be less complex to performcertain arithmetic operations in hardware such as addition andsubtraction on fixed point numbers due to the fixed position of theradix point. An example of a circuit for converting a floating pointnumber to a fixed point number is shown in FIG. 3 . The circuit 300comprises a shifter 301 coupled to a subtraction unit 303 and a negationunit 305. The floating point number 100 to be converted is shown for thepurposes of illustration.

The negation unit is configured to receive the sign bit of the floatingpoint number as a first input, and the mantissa of the floating pointnumber as a second input. The negation unit is configured to take thecomplement of the mantissa and output the result if the sign bitindicates the floating point number represents a negative value. If thesign bit indicates that the floating point number represents a positivevalue, the negation unit does not take the complement of the mantissaand instead outputs the mantissa unaltered.

The subtraction unit receives as an input the exponent E of the floatingpoint number and subtracts from that value the exponent bias B. Thevalue of the bias may be fixed, or pre-determined, so that thesubtraction unit is configured to subtract a fixed value from theexponent value. The value of the subtraction (E-B) is then output to theshifter 301.

The shifter 301 receives as a first input the mantissa M from thenegation unit 305 and as a second input the value (E-B) from thesubtraction unit 303. The shifter is operable to shift the mantissa leftor right by a number of bits equal to the magnitude of the value of(E-B) to convert the floating point number to fixed point format. Inparticular, the shifter is configured to left-shift the mantissa by anumber of bits equal to the value of (E-B) when (E-B) is greater thanzero, and right-shift the mantissa by a number of bits equal to thevalue of (B-E) when the value of (E-B) is less than zero. The shiftedmantissa is then output as the fixed point number. The output fixedpoint number may then be rounded. Examples of rounding modes includeround-to-zero (RTZ), round-to-negative-infinity (RTN), round to positiveinfinity (RTP)and round-to-nearest-even (RNE).

The critical path of the binary circuit that determines the speed atwhich the circuit can convert a floating point number to a fixed pointnumber may depend on the rounding mode and on whether the floating pointnumber is signed or unsigned. For example, for an unsigned floatingpoint number, the subtraction of the bias from the exponent is in thecritical path of the circuit; for signed negative floating point numbersusing RNI, the negation of the mantissa is in the critical path.

SUMMARY

This Summary is provided to introduce a selection of concepts in asimplified form that are further described below in the DetailedDescription. This Summary is not intended to identify key features oressential features of the claimed subject matter, nor is it intended tobe used to limit the scope of the claimed subject matter.

According to a first aspect of the present disclosure there is provideda binary logic circuit for converting a number in floating point formathaving an exponent E of ew bits, an exponent bias B given by B =2^(ew-1) - 1, and a significand comprising a mantissa M of mw bits intoa fixed point format with an integer width of iw bits and a fractionalwidth of fw bits, the circuit comprising:

-   a first shifter operable to receive a first significand input    comprising a contiguous set of the most significant bits of the    significand and configured to left-shift the input by a number of    bits equal to the value represented by k least significant bits of    the exponent to generate a first output, wherein min{(ew - 1),    bitwidth(iw - 2 -s_(y))} ≤ k ≤ (ew - 1) here s_(y) = 1 for a signed    floating point number and s_(y) = 0 for an unsigned floating point    number;-   an inverting unit configured to invert the bit values of the    exponent;-   a second shifter coupled to the inverting unit configured to receive    a second significand input comprising a contiguous set of the most    significant bits of the significand and configured to right-shift    the input by a number of bits equal to the value represented by the    p least significant bits of the inverted exponent to generate a    second output, wherein min{(ew - 1), bitwidth(fw)} ≤ p ≤ (ew - 1);    and-   a multiplexer coupled to the first and second shifters and    configured to: receive a first input comprising a contiguous set of    bits of the first output and a second input comprising a contiguous    set of bits of the second output; and output the first input if the    most significant bit of the exponent is equal to one; and output the    second input if the most significant bit of the exponent is equal to    zero.

The circuit may further comprise a first formatting unit coupled to thefirst shifter, the formatting unit configured to receive as an input astring comprising the mw mantissa bits and to format the string togenerate the significand input to the first shifter.

The formatting unit may be configured to perform one or more formattingoperations comprising appending (iw-2-s_(y)) bits to the mostsignificant bit of the significand, where s_(y) = 0 and the appendedbits are zero bits for an unsigned floating point number, and s_(y) = 1and the appended bits are sign bits for a signed floating point number.

The first input of the multiplexer may be equal to the first output.

The first shifter may have a bit width equal to iw″ + min(mw,(fw+iw″)),where iw″ = min{(iw-2-s_(y)), 2^(ew-1)-2}.

The formatting unit may be configured to perform one or more formattingoperations comprising appending (iw-1-s_(y)) bits to the mostsignificant bit of the significand, where s_(y) = 0 and the appendedbits are zero bits for an unsigned floating point number, and s_(y) = 1and the appended bits are sign bits for a signed floating point number.

The circuit may further comprise a correction unit coupled to the firstshifter and the multiplexer, the correction unit being configured toreceive the first output and to discard its most significant bit andappend a zero-bit to its least significant bit to form the first inputto the multiplexer.

The first shifter may have a bit width equal to iw′ + min(mw, (fw+iw′)),where iw′ = min{(iw-1-s_(y)), 2^(ew-1)-1}.

The formatting unit may be further configured to truncate a set of leastsignificant bits of the mw mantissa bits that would not form part of thefw bits of the fixed point format if left-shifted by a value equal tothe shift range of the first shifter.

The first shifter may have a shift range limited to the minimum of: i)iw-2-s_(y); and ii) 2^(ew-) ¹-2

The floating point format and fixed point format may be such that(iw-s_(y-)1) < 2^(ew-1)-1, and k is equal to the bit width of the value(iw-s_(y-)2), where s_(y)=1 for a signed floating point number ands_(y)=0 for an unsigned floating point number.

The floating point format and fixed point format may be such that2^(ew-1)-1 ≤ (iw-S_(y)-1), and k= ew-1, where s_(y)=1 for a signedfloating point number and s_(y)=0 for an unsigned floating point number.

The circuit may further comprise a second formatting unit coupled to thesecond shifter, the second formatting unit configured to receive as aninput string comprising the mw mantissa bits and to format the string togenerate the second significand input to the second shifter.

The formatting unit may be configured to truncate the (mw-fw) leastsignificant bits of the mantissa when mw > fw.

The second shifter may have a bit width equal to: (1 +s_(y)) + min(fw,mw + 2^(ew-1) - 2).

The second shifter may have a shift range limited to the minimum of: i)2^(ew-1)-2; and ii) fw.

The circuit may further comprise a third formatting unit coupled to thesecond shifter, the third formatting unit being configured to append(iw-1-s_(y)) bits to the most significant bit of the second output,where s_(y) = 0 and the appended bits are zero bits for an unsignedfloating point number, and s_(y) = 1 and the appended bits are sign bitsfor a signed floating point number.

The floating point format and fixed point format may be such that fw <2^(ew-1)-1 and p is equal to the bit width to represent fw.

The floating point and fixed point numbers may be such that fw ≥2^(ew-1)-1 and p = ew-1.

The binary logic circuit may further comprise exception-handlingcircuitry configured to output an exception result in response todetecting an exception condition from a set of exception conditionscomprising at least one of: i) E > B + iw -1 - s_(y); ii) E < B -fw,where s_(y) = 1 for a signed number and s_(y)=0 for an unsigned number.

The binary logic circuit may further comprise an output multiplexerconfigure to multiplex between the exception result and the output fromthe multiplexer coupled to the first and second shifters.

According to another aspect of the present disclosure there is provideda method of converting a number in floating point format having anexponent E of ew bits, an exponent bias B given by B = 2^(ew-1) - 1, anda significand comprising a mantissa M of mw bits into a fixed pointformat with an integer width of iw bits and a fractional width of fwbits, the method comprising:

-   receiving at a first shifter a first significand input comprising a    contiguous set of the most significant bits of the significand and    left-shifting the input by a number of bits equal to the value    represented by k least significant bits of the exponent to generate    a first output, wherein min{(ew - 1), bitwidth(iw - 2 - sy)} ≤ k ≤    (ew - 1) where s_(y) = 1 for a signed floating point number and    s_(y) = 0 for an unsigned floating point number;-   inverting at an inverting unit the bit values of the exponent;-   receiving at a second shifter a second significand input comprising    a contiguous set of the most significant bits of the significand and    right-shifting the input by a number of bits equal to the value    represented by the p least significant bits of the inverted exponent    to generate a second output, wherein min{(ew - 1), bitwidth(fw)} ≤ p    ≤ (ew - 1); and-   receiving at a multiplexer a first input comprising a contiguous set    of bits of the first output and a second input comprising a    contiguous set of bits of the second output and outputting the first    input if the most significant bit of the exponent is equal to one    and outputting the second input if the most significant bit of the    exponent is equal to zero.

The method may further comprise receiving at a first formatting unit aninput string comprising the mw mantissa bits and formatting the stringto generate the significand input to the first shifter.

The step of formatting the string to generate the input to the firstshifter may comprise appending (iw-2-s_(y)) bits to the most significantbit of the significand, where s_(y) = 0 and the appended bits are zerobits for an unsigned floating point number, and s_(y) = 1 and theappended bits are sign bits for a signed floating point number.

The first input of the multiplexer may be equal to the first output.

The first shifter may have a bit width equal to iw″ + min(mw,(fw+iw″)),where iw″ = min{(iw-2-s_(y)), 2^(ew-1)-2}.

The method may comprise performing one or more formatting operationscomprising appending (iw-1-s_(y)) bits to the most significant bit ofthe significand, where s_(y) = 0 and the appended bits are zero bits foran unsigned floating point number, and s_(y) = 1 and the appended bitsare sign bits for a signed floating point number.

The method may further comprise receiving at a correction unit the firstoutput and discarding its most significant bit and appending a zero-bitto its least significant bit to form the first input to the multiplexer.

The first shifter may have a bit width equal to iw′ + min(mw, (fw+iw′)),where iw′ = min{(iw-1-s_(y)), 2^(ew-1)-1}.

The method may further comprise truncating at the formatting unit a setof least significant bits of the mw mantissa bits that would not formpart of the fw bits of the fixed point format if left-shifted by a valueequal to the shift range of the first shifter.

The first shifter may have a shift range limited to the minimum of: i)iw-2-s_(y); and ii) 2^(ew-) ¹-2.

The floating point format and fixed point format may be such that(iw-s_(y-)1) < 2^(ew-1)-1, and k is equal to the bit width of the value(iw-s_(y-)2), where s_(y)=1 for a signed floating point number ands_(y)=0 for an unsigned floating point number.

The floating point format and fixed point format may be such that(iw-s_(y-)1) > 2^(ew-1)-1, and k= ew-1, where s_(y)=1 for a signedfloating point number and s_(y)=0 for an unsigned floating point number.

The method may further comprise receiving, at a second formatting unitcoupled to the second shifter, an input string comprising the mwmantissa bits and formatting the string to generate the secondsignificand input to the second shifter.

The method may comprise truncating at the second formatting unit the(mw-fw) least significant bits of the mantissa when mw > fw.

The second shifter may have a bit width equal to: (1 +s_(y)) + min(fw,mw + 2^(ew-1) - 2).

The second shifter may have a shift range limited to the minimum of: i)2^(ew-1)-2; and ii) fw.

The floating point format and fixed point format may be such that fw <2^(ew-1)-1 and p is equal to the bit width to represent fw.

The floating point and fixed point numbers may be such that fw ≥2^(ew-1)-1 and p = ew-1.

The method further may further comprise outputting an exception resultin response to detecting an exception condition from a set of exceptionconditions comprising at least one of: i) E > B + iw -1 - s_(y); ii) E <B + iw -1 - s_(y), where s_(y) = 1 for a signed number and s_(y)=0 foran unsigned number.

The method may further comprise multiplexing between the exceptionresult and the output from the multiplexer.

According to another aspect of the present disclosure there is provideda binary logic circuit for converting a number in floating point formathaving an exponent E, an exponent bias B = 2^(ew-1)-1, and a significandcomprising a mantissa M of mw bits into a fixed point format with aninteger width of iw bits and a fractional width of fw bits, the circuitcomprising:

-   an offset unit configured to offset the exponent of the floating    point number by an offset value to generate a shift value s_(v) of    sw bits, the offset value being equal to a maximum amount by which    the significand can be left-shifted before overflow occurs in the    fixed point format;-   a right-shifter operable to receive a significand input comprising a    formatted set of bits derived from the significand, the shifter    being configured to right-shift the input by a number of bits equal    to the value represented by k least significant bits of the shift    value to generate an output result, where bitwidth[min(2^(ew-1) - 1,    iw - 1 - s_(y)) + min(2^(ew-1) - 2,fw)] ≤ k ≤ sw, where s_(y) = 1    for a signed floating point number and s_(y) = 0 for an unsigned    floating point number.

The offset unit may be configured to offset the exponent of the floatingpoint number by a value equal to (iw-1-s_(y)), where s_(y) = 1 for asigned number and s_(y) = 0 for an unsigned number.

Th offset unit may be configured to generate a shift value given bys_(v) = (B-E) + (iw-1-Sy).

The right-shifter may have a shift-range limited to: [min(2^(ew-1) - 1,iw - 1 - s_(y)) + min(2^(ew-1) - 2,fw)]

The floating point number may be a signed number and the binary logiccircuit may further comprise a negating unit, the negating unit beingconfigured to receive a sign bit indicating the sign of the floatingpoint number, and an input comprising a set of most significant bits ofthe significand and to take the complement of those significand bits independence on the value of a sign bit of the number to generate a signednumber in the form sY.M, where s represents the sign bit of the number,and Y represents the leading bit of the significand.

The binary logic circuit may further comprise a formatting unit coupledto the right-shifter and configured to truncate the [mw - (iw + fw -(1 + s_(y)))] least significant bits of the mantissa when mw > (iw + fw-(1+sy)).

The shifter may have a bitwidth equal to the minimum of: i) iw+fw; andii) 1+s_(y) + mw + min(2^(ew-1) - 1, iw - 1 - s_(y)) + min(2^(ew-1) -2,fw)].

The formatting unit may be coupled to the negating unit.

According to another aspect of the present disclosure there is provideda method of converting a number in floating point format comprising anexponent E, an exponent bias B = 2^(ew-1)-1 , and a significandcomprising a mantissa M of mw bits into a fixed point format with aninteger width of iw bits and a fractional width of fw bits, the methodcomprising:

-   offsetting the exponent of the floating point number by a value    equal to a maximum amount by which the significand can be    left-shifted before overflow occurs in the fixed point format to    generate a shift value s_(v) of sw bits;-   receiving a significand input comprising a formatted set of bits    derived from the significand at a right-shifter and right-shifting    the input by a number of bits equal to the value represented by k    least significant bits of the shift value to generate an output    result, where bitwidth[min(2^(ew-1) - 1, iw - 1 - s_(y)) +    min(2^(ew-1) - 2,fw)] ≤ k ≤ sw, where s_(y) = 1 for a signed    floating point number and s_(y) = 0 for an unsigned floating point    number.

The exponent may be offset by a value equal to (iw-1-s_(y)), where s_(y)= 1 for a signed number having a sign bit and s_(y) = 0 for an unsignednumber.

The shift value generated may be given by s_(v) = (B-E) + (iw-1-s_(y)).

The right shifter may have a shift range limited to [min(2^(ew-1) - 1,iw - 1 - s_(y)) + min(2^(ew-1) - 2,fw)].

The method may further comprise receiving at a negating unit a sign bitof the floating point number and an input comprising a set of mostsignificant bits of the significand, and taking the complement of thosesignificand bits in dependence on the value of the sign bit to generatea signed number in the form sY.M, where s represents the sign bit of thenumber, and Y represents the leading bit of the significand.

The method may further comprise truncating at a formatting unit the[mw - (iw + fw -(1 + s_(y)))] least significant bits of the mantissawhen mw > (iw + fw -(1 +sy)).

The shifter may have a bitwidth equal to the minimum of: i) iw+fw; andii) 1+s_(y) + mw + min(2^(ew-1) - 1, iw - 1 - s_(y)) + min(2^(ew-1) -2,fw)].

According to another aspect of the present disclosure there is provideda binary logic circuit for converting a number in floating point formatcomprising an exponent E, an exponent bias B = 2^(ew-1)-1, and asignificand comprising a mantissa of mw bits into a fixed point formatwith an integer width of iw bits and a fractional width of fw bits, thecircuit comprising:

-   an offset unit configured to offset the exponent of the floating    point number by an offset value to generate a shift value s_(v) of    sw bits, the offset value being equal to a maximum amount by which    the significand can be right-shifted before underflow occurs in the    fixed point format; and-   a left-shifter operable to receive a significand input comprising a    formatted set of bits derived from the significand, the shifter    being configured to left-shift the input by a number of bits equal    to the value represented by k least significant bits of the shift    value to generate an output result, where bitwidth[min(2^(ew-1) - 1,    iw - 1 - s_(y)) + min(2^(ew-1) - 2,fw)] ≤ k ≤ sw and s_(y) = 1 for a    signed floating point number and s_(y) = 0 for an unsigned floating    point number.

The offset unit may be configured to offset the exponent of the floatingpoint input by a value equal to fw.

The offset unit may be configured to generate a shift value given bys_(y) = (E-B) + fw. The left-shifter may have a shift-range limited to:[min(2^(ew-1) - 1, iw - 1 - s_(y)) + min(2^(ew-1) - 2,fw)]

The floating point number may be a signed number and the binary logiccircuit may further comprise a negating unit, the negating unit beingconfigured to receive a sign bit and an input comprising a set of mostsignificant bits of the significand and to take the complement of thosesignificand bits in dependence on the value of a sign bit of the numberto generate a signed number in the form sY.M, where s represents thesign bit of the number, and Y represents the leading bit of thesignificand.

The binary logic circuit may further comprise a formatting unit coupledto the left-shifter and configured to format the significand toleft-align the significand with the fixed point format.

The formatting unit may be configured to append (iw+fw-(1+s_(y))) bitsto the leading bit of the significand, where s_(y) = 0 and the appendedbits are zero bits for an unsigned floating point number, and s_(y) = 1and the appended bits are sign bits for a signed floating point number.

The shifter may have a bit width of width_(LS)′, and the formatting unitmay be configured to truncate [iw+fw+mw-width_(LS′]) least significantbits of the mantissa when (iw+fw+mw) > width_(LS)′.

The bit width of the shifter, width_(LS)′ may be equal to: iw + fw +min(2^(ew-1) - 1, iw - 1 -s_(y)) + min(2^(ew-1) - 2,fw)].

The formatting unit may be coupled to the negating unit.

The formatting unit may be configured to receive as an input the outputfrom the negating unit.

According to another aspect of the present disclosure there is providedmethod of converting a number in floating point format comprising anexponent E, an exponent bias B = 2^(ew-1)-1, and a significandcomprising a mantissa of mw bits into a fixed point format with aninteger width of iw bits and a fractional width of fw bits, the methodcomprising:

-   offsetting the exponent of the floating point number by an offset    value equal to a maximum amount by which the significand can be    right-shifted before underflow occurs in the fixed point format to    generate a shift value s_(v) of sw bits; and-   receiving at a left-shifter a significand input comprising a    formatted set of bits derived from the significand, and    left-shifting the input by a number of bits equal to the value    represented by k least significant bits of the shift value to    generate an output result, where bitwidth[min(2^(ew-1) - 1, iw - 1 -    s_(y)) + min(2^(ew-1) - 2,fw)] ≤ k ≤ sw, and s_(y) = 1 for a signed    floating point number and s_(y) = 0 for an unsigned floating point    number.

The exponent ma be offset by a value equal to fw.

The generated shift value may be given by s_(y) = (E-B) + fw.

The left-shifter may have a shift-range limited to: [min(2^(ew-1) - 1,iw - 1 - s_(y)) + min(2^(ew-1) - 2,fw)]

The floating point number may be a signed number and the method mayfurther comprise receiving at a negating unit a sign bit indicating thesign of the number and an input comprising a set of most significantbits of the significand, and taking the complement of the significantbits in dependence on the a signed number in the form sY.M, where srepresents the sign bit of the number, and Y represents the leading bitof the significand.

The method may further comprise formatting at a formatting unit thesignificand to left-align the significand with the fixed point format.

The step of formatting the significand may comprise appending(iw+fw-(1+s_(y))) bits to the leading bit of the significand, wheres_(y) = 0 and the appended bits are zero bits for an unsigned floatingpoint number, and s_(y) = 1 and the appended bits are sign bits for asigned floating point number.

The shifter may have a bit width of width_(LS)′, and the formatting unitis configured to truncate [iw+fw+mw-width_(LS′]) least significant bitsof the mantissa when (iw+fw+mw) > width_(LS)′.

The bit width of the shifter, width_(LS)′may be equal to: iw + fw +min(2^(ew-1) - 1, iw - 1 -s_(y)) + min(2^(ew-1) - 2,fw)].

The binary logic circuits above may be embodied in hardware on anintegrated circuit.

There may be provided a method of manufacturing, at an integratedcircuit manufacturing system, a binary logic described herein.

There may be provided an integrated circuit definition dataset that,when processed in an integrated circuit manufacturing system, configuresthe integrated circuit manufacturing system to manufacture a binarylogic circuit described herein.

There may be provided a non-transitory computer readable storage mediumhaving stored thereon a computer readable description of an integratedcircuit that, when processed in an integrated circuit manufacturingsystem, causes the integrated circuit manufacturing system tomanufacture a binary logic circuit as described herein.

There may be provided an integrated circuit manufacturing systemcomprising:

-   a non-transitory computer readable storage medium having stored    thereon a computer readable description of an integrated circuit    that describes a binary logic circuit as described herein;    -   a layout processing system configured to process the integrated        circuit description so as to generate a circuit layout        description of an integrated circuit embodying the binary logic        circuit; and    -   an integrated circuit generation system configured to        manufacture the binary logic circuit according to the circuit        layout description.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention will now be described by way of example withreference to the accompanying drawings. In the drawings:

FIG. 1 shows a schematic illustration of a signed floating point number.

FIG. 2 shows a schematic illustration of a fixed point number.

FIG. 3 shows an example of a logic circuit for converting a number infloating point format to fixed point format.

FIG. 4 shows an example of a split-path shifter for converting a numberin floating point format to fixed point format without having tosubtract the bias from the exponent.

FIG. 5A shows an example of a binary logic circuit for converting anunsigned floating point number to a fixed point number.

FIG. 5B shows an example of a binary logic circuit for converting asigned floating point number to a fixed point number.

FIG. 6A shows a schematic illustration of how a significand may beformatted and left-shifted to convert the floating point number to afixed point number.

FIG. 6B shows an alternative schematic illustration of how a significandmay be formatted and right-shifted to convert the floating point numberto a fixed point number.

FIG. 6C shows a schematic illustration of how a significand may beformatted and left-shifted to convert the floating point number to afixed point number.

FIG. 7 shows an example of a single-shifter binary logic circuit forconverting a floating point number to a fixed point number.

FIG. 8 shows a schematic illustration of how the single shifter of FIG.7 can shift a significand to convert the number from floating point tofixed point format.

FIG. 9 shows a further example of a single-shifter binary logic circuitfor converting a floating point number to a fixed point number.

FIG. 10 shows a schematic illustration of how the single shifter of FIG.9 can shift a significand to convert the number from floating point tofixed point format

FIG. 11 shows an example integrated circuit manufacturing system forprocessing an integrated circuit definition dataset and manufacturing abinary logic circuit.

Where appropriate, like reference numerals have been used to denote likecomponents

DETAILED DESCRIPTION

The present disclosure describes various binary logic circuits forconverting a binary number in floating point format, or representation,to a fixed point format, or representation. A number in floating pointformat may be referred to herein as a floating point number, andsimilarly a number in fixed point format may be referred to as a fixedpoint number. The floating point number may have an unsigned integerexponent biased by an exponent bias. The binary logic circuits can bebroadly classed into two types: those with a split-path shifter capableof left-shifting and right-shifting a mantissa; and those with a singleshifter (either a single right-shifter or a single left-shifter) forshifting the mantissa. The split-path shifter is configured to shift themantissa of the floating point number by a number of bits determinedfrom the exponent of the floating point number. That is, the split-pathshifter can determine the shift to apply to the mantissa by exploitingknowledge of the exponent and without having to perform the subtractionof the bias from the exponent. The single-shifter circuits areconfigured to offset the exponent bias of the floating point number by avalue dependent on either the integer width or fractional width of thefixed point format to which the floating point is being converted. Thisenables the single-shifter circuits to convert the floating point numberto fixed point format over a range of ‘true’ exponent values (i.e. forboth positive and negative ‘true’ exponent values) using only a singleshifter. The structure and operation of various examples of binary logiccircuits are described in more detail below.

As used herein, the term ‘significand’ comprises a leading bit Y and amantissa M separated by a radix point, i.e. the significand representsthe value Y.M (=Y.0 + 0.M). The mantissa is formed of mw bits.

Split-Path Shifter

FIG. 4 shows an example of a binary logic circuit 400 for converting abinary number in floating point format to a binary number in fixed pointformat. The binary number could be a signed number (i.e. comprising asign bit) or an unsigned number (containing no sign bit). The fixedpoint number has an integer width of iw bits and a fractional width offw bits. In other words, the fixed point number has an integer part ofiw bits and a fractional part of fw bits. The fixed point numberrepresents the value I.W. The value I.W could be in Siw.fw format, where‘S’ indicates that it is a signed format, or Uiw.fw, where ‘U’ indicatesit is an unsigned format.

The binary logic circuit is shown generally at 400 and comprises aleft-shifter 401 and right-shifter 403 coupled to a multiplexer 405. Thecircuit further comprises an inverting unit 407 coupled to theright-shifter.

The floating point number to be converted is shown schematically at 409and comprises an exponent field of ew bits representing the exponent Eand a mantissa field of mw bits representing the mantissa M. For thepurposes of simplicity, in this example the floating point is unsigned.The exponent is biased by an exponent bias B. The exponent bias is givenby B=2^(ew-1) - 1. The mantissa forms part of a significand comprising aleading bit Y and the mantissa M. The significand may be normal (i.e.the leading bit is ‘1’) or denormal (i.e. the leading bit is ‘0’). Thebitwidth of the mantissa is mw bits; and the bitwidth of the significandis (mw+1) bits. The floating point number therefore represents the valuegiven by 2^(E~B) × significand = 2^(B-B) × Y.M, where Y = 1 for a normalfloating point number and Y = 0 for a denormal floating point number.The value (E-B) may be referred to as the ‘true’ exponent of thefloating point number. In general, the value of the true exponent isused to determine the number of bits by which to shift the significandwhen converting the number from floating point format to fixed pointformat.

The inverting unit 407 is configured to receive the ew-1 leastsignificant bits of the exponent E and to invert each received bit valueof the exponent. That is, the inverting unit is configured to perform abit-wise inversion on the bits of the exponent to generate a set ofinverted exponent bits. Here, an inversion means that the binary valueof a bit is inverted to its complementary value, e.g. a bit value of 1is inverted to a 0, and a bit value of 0 is inverted to a 1. Theinverting unit then outputs the ew-1 least significant bits of theinverted exponent on line 411. The inverted exponent may be denoted asE.

Both the left-shifter 401 and the right shifter 403 are configured toreceive as an input the mantissa M. The mantissa is an example of a moregeneral significand input. The significand inputs may additionallycomprise the leading bit Y of the significand, or else this may beseparately received by each shifter, or added to the mantissa within theshifters to form the significand. Examples of other types of floatingpoint input will be described below. Y may be assumed to be ‘1’, withcases where Y=0 being treated as an exception. The left-shifter isconfigured to perform left-shift operations on its significand inputs togenerate a first output, and the right-shifter is configured to performright-shift operations on its significand inputs to generate a secondoutput. The left-shifter and right-shifter may be barrel shifters, forexample. The left-shifter is further configured to receive as an inputthe ew-1 least significant bits of the exponent E. The right-shifter isfurther configured to receive as an input the ew-1 least significantbits of the inverted exponent E output from the inverting unit 407.

The right shifter 403 is configured to right-shift the significand by anumber of bits equal to the value represented by the ew-1 leastsignificant bits of the inverted exponent E. That is, the right-shifteris configured to shift the significand input to the right by a number ofbits equal to the value represented by the binary string E[ew-2:0] (i.e.the string represented by the 0^(th)-(ew-2)^(th) bits of the invertedexponent, where the 0’th bit refers to the least significant bit). Ithas been found that, when the most significant bit of the exponent E isequal to 0, shifting the significand by the value represented by (ew-1)least significant bits of the inverted exponent E can be used tocorrectly shift the significand in accordance with the values of theexponent E and bias B without having to perform the subtraction of thebias from the exponent.

To see this, consider an example where, for simplicity, ew=5 and mw=8.In particular, consider an example in which E = 00101 (i.e. E = 5 indecimal format) and significand = 1.0 + 0.M = 1.0101001. The bias Bisthus given by B=2^(ew-1) - 1 = 15 (i.e. 8=01111 in binary format), andE=11010. The value represented by the floating point number is thengiven by 2^(E~B) × 1. mantissa = 2⁻¹⁰ × 1.0101001. That is, the value ofthe true exponent is equal to -10, which means the significand is to beshifted to the right by ten bits. In general, when the value of the trueexponent (E-B) is negative, the significand is to be shifted to theright by a number of bits equal to the magnitude of the true exponent,i.e. the significand is to be shifted to the right by a number of bitsequal to the value of (B-E). Turning to our specific example, (B-E) =01111-00101 = 01010. A comparison of this value with the invertedexponent E reveals that (B-E) is equal to the ew-1 (i.e. 4, in thisexample) least significant bits of the inverted exponent.

Thus by configuring the right shifter 403 to shift the significand tothe right by a number of bits equal to the value represented by the(ew-1) least significant bits of the inverse of the exponent, the rightshifter 403 can correctly shift the significand in accordance with theexponent E and bias B without having to subtract the bias from theexponent.

The left-shifter 401 is configured to left-shift the mantissa M (andhence the significand) by a number of bits equal to the valuerepresented by the ew-1 least significant bits of the exponent E. Thatis, the left-shifter is configured to shift the significand input to theleft by a number of bits equal to the value represented by the binarystring E[ew-2:0] (i.e. the string represented by the 0^(th)-(ew-2)^(th)bits of the exponent). It has been found that, when the most significantbit of the exponent is equal to 1, shifting the significand by the valuerepresented by (ew-1) least significant bits of the exponent can be usedto shift the significand in accordance with the values of the exponent Eand bias B without having to perform the subtraction of the bias fromthe exponent.

To see this, consider another example where E = 11010 (i.e. E = 26 indecimal format) and M = 0101001. The bias B is again given byB=2^(ew-1) - 1=01111 (i.e. B=15 in decimal format). The valuerepresented by the floating point number is then given by 2^(E-B) × 1.mantissa = 2¹¹ × 1.0101001, which means the significand is to be shiftedto the left by 11 bits.

Instead of subtracting the bias B from the exponent, considersubtracting (B+1) from the exponent. B+1=2^(ew-1)=10000 in binaryformat. Thus (E-(B+1))=11010-10000=01010. A comparison of (E-(B+1)) withE reveals that the value of (E-(B+1)) is equal to the value representedby the four least significant bits of the exponent E. In general, whenB=2^(ew-1) - 1, (E-(B+1)) = E[ew-2:0] when E(ew-1)=1. Thus, byconfiguring the left-shifter to left-shift the significand by a numberof bits equal to the value represented by the ew-1 least significantbits of the exponent, the left-shifter can shift the significand to theleft by a number of bits equal to (E-(B+1)) without having to subtractthe bias from the exponent.

Shifting the significand to the left by a number of bits equal to(E-(B+1)) results in the significand being left-shifted by one bit lessthan indicated by the value of the true exponent (E-B). Approaches forcorrecting the shift are discussed below with reference to FIGS. 5, and6A-6C but in one example, the left-shifter is configured to perform oneadditional shift to that indicated by the value of the ew-1 bits of theexponent E. That is, the left-shifter is configured to receive theexponent E, determine the value of its ew-1 least significant bits andleft-shift the significand by a number of bits equal to that value plusone, i.e. the left-shifter is configured to left-shift its inputs by avalue equal to the binary string E[ew-2:0] + 1.

The multiplexer 405 is configured to receive as an input a contiguousset of the most significant bits of the exponent E. The contiguous setof the most significant bits may be a subset of the bits of the exponentthat includes the most significant bits. The multiplexer may receive allew bits of the exponent. In some examples, the multiplexer may receiveonly the most significant bit of the exponent (as shown in FIG. 4 ). Themultiplexer is further configured to receive as inputs the first andsecond outputs from the left and right-shifter respectively.

The multiplexer 405 is configured to output the output from theleft-shifter if the most significant bit of the exponent E is equal toone, and to output the output from the right-shifter if the mostsignificant bit of the exponent E is equal to zero. Configuring themultiplexer in this way means the correct result from the shifters isoutput in accordance with the sign of the true exponent (E-B). That is,when B=2^(ew-1) - 1, if the most significant bit of the exponent isequal to one, it follows that the value of (E-B) > 0 and thus thesignificand is to be left-shifted when converting to fixed point format;and when the most significant bit of the exponent is equal to zero, thevalue of (E-B) ≤ 0 and thus the significand is to be right-shifted whenconverting to fixed point format.

The above example illustrates the principle by which the left and rightshifters can exploit the knowledge of the exponent to shift thesignificand without having to perform the step of subtracting the biasfrom the exponent. Thus binary logic circuit 400 is capable ofconverting a number from floating point to fixed point format withouthaving to perform the operation of subtracting the bias from theexponent. This is advantageous because subtracting the bias from theexponent takes time and thus avoiding this operation may increase thespeed at which a floating point number can be converted to a fixed pointformat. It may also reduce the hardware requirements of the circuit bynegating the need for any circuitry to perform the subtraction.

Below, variations and examples of circuit 400 will be described thatillustrate in more detail how the circuit may operate and how inputs tothe circuit may be formatted for various kinds of floating point andfixed point formats, such as the size of the integer width, thefractional width, the number of bits of the exponent etc. Variousoptimisations of the circuit are also described.

The bit string of the significand may be formatted prior to being inputto the shifters. The inputs to the left and right shifters may beseparately formatted. The formatting may depend on whether the floatingpoint inputs are signed or unsigned. In certain cases, depending on thesize of the mantissa and the values of the integer width iw andfractional width fw, the formatting may include re-sizing thesignificand. The significand may need to be re-sized to the bitwidth ofthe left and/or right shifters (i.e. so that the number of bits in there-sized significand is equal to the bit width of the shifter).Re-sizing may include appending one or more ‘0’s’ to the mostsignificant bit of the significand, also known as zero padding theleading bits of the significand. Re-sizing may additionally includetruncating one or more least significant bits of the mantissa. Bits maybe truncated when it is known those bits will not be shifted into thefractional bits of the fixed point number (e.g. due to the limits on themaximum left-shift imposed by the bit-width ew of the exponent).Examples of how the binary logic circuit formats the significand aredescribed with reference to FIGS. 5 and 6A to 6C.

FIG. 5A shows an example binary logic circuit 500 for converting anunsigned number in floating point format to a number in fixed pointformat. The floating point number represents the value given in generalby 2^(E~B) × significand = 2^(E~B) × Y.M, where E is again the exponentof ew bits, B is the exponent bias given by B=2^(ew-1) -1, Y is theleading bit of the significand and M is the mantissa having a width ofmw bits. The fixed point number has an integer width of iw bits and afractional width of fw bits.

As before, the binary logic circuit 500 comprises left-shifter 401 andright-shifter 403 coupled to multiplexer 405, and inverting unit 407coupled to the right-shifter. The circuit 500 further comprisesformatting units 501, 511 and 513. Formatting unit 501 is a pre-shiftformatting unit for the left shifter 401; formatting unit 513 is apre-shift formatting unit for the right-shifter 403; and formatting unit511 is a post-shift formatting unit for the right-shifter 403. Theformatting unit 501 is coupled to the left shifter 401; the formattingunit 513 is coupled to the right-shifter 403 and the formatting unit 511is coupled to both the right shifter 403 and the multiplexer 405. Thecircuit further comprises a corrector unit 509 coupled to theleft-shifter and the multiplexer 405 for incrementing the shift of thesignificand by one place to the left. Thus the corrector uniteffectively corrects for the fact that the left-shifter only shifts thesignificand by (E-(B+1)) bits to the left, rather than (E-B) bits.

The circuit 500 further comprises exception-detection circuitry 503configured to receive as an input the exponent E and optionally themantissa M. The circuitry is coupled to an output multiplexer 505. Theoutput multiplexer could form part of the binary logic circuit 500 orcould be a separate component. The output multiplexer 505 is alsocoupled to the multiplexer 405. The circuitry 503 may be pre-configuredto know, or have pre-stored thereon, the values of the integer width iw,fractional width fw and bias B and whether the numbers to be convertedare signed or un-signed.

Operation of the circuit during a left-shift operation will now bedescribed.

The formatting unit 501 receives the mantissa M as an input and formatsthat input to generate a significand input to the left shifter. Theformatting unit 501 may also receive the implicit leading bit Y of thesignificand (and so receive the whole significand as an input), or itmay add the implicit high bit to the mantissa to form the significand.The formatting unit may format the significand by performing one or moreformatting operations. The formatting unit may format the significand togenerate a floating point input having a number of bits equal to the bitwidth of the left shifter 401. An illustration of this process is shownin FIG. 6A. In this example the floating point number is an unsignedfloating point number having a significand given by 1.M = 10110010 (i.e.mw=7), and is to be converted to a fixed point format having an integerpart of 4 bits (i.e. iw=4) and a fractional part of 5 bits (i.e. fw=5).

FIG. 6A shows the bits of the significand 601 received at the formattingunit 501. For this example, the value of (E-B) = 3 and so thesignificand is to be shifted to the left by 3 bits. The integer width iwand fractional width fw of the fixed point number is shown relative tothe bits of the significand. The shifter width of the left shifter 401is shown (denoted width_(LS))

The formatting unit 501 appends (iw-1) zeros to the most significant bitof the significand (i.e. to the significand’s leading edge). Theformatting unit does this to align the significand with the radix pointin the fixed point format. Thus, in this particular example theformatting unit appends 3 zeros to the leading bits of the significandto generate the binary string 00010110010, denoted 603. The significandis now aligned with the bit positions of the fixed point format so thatthe leading bit Y of the significand corresponds to the bit immediatelyto the left of the radix point separating the integer bits and thefractional bits, and the leading bit of the mantissa M corresponds tothe bit immediately to the right of the radix point; i.e. the leadingbit Y and the mantissa M are separated by the radix point.

In this example, the width of the left shifter, width_(LS) = iw + mw.Thus, once the formatting unit has 501 has appended the (iw-1) zero bitsto the leading bit of the significand, the significand is formatted forinput to the left-shifter (i.e. the formatted significand has a numberof bits equal to the bit-width of the left-shifter).

Setting the bit width of the left-shifter to a value of iw + mw ensuresthat no bits of the significand are truncated prior to being input intothe left-shifter, which is beneficial for providing an accurate shiftresult. However, in other examples, the bit-width of the left-shiftermay be less than iw + mw (for example to reduce the hardwarerequirements of the shifter). In this case, the significand, havingbeing formatted to append (iw-1) zero bits to its leading edge, may havea bit width greater than the bit width of the left shifter. In thiscase, the formatting unit 501 may truncate a number of least significantbits of the mantissa to reduce the number of bits to be equal to the bitwidth of the shifter 401. Mathematically, the formatting unit maytruncate [mw + iw] -width_(LS) least significant bits of the significandwhen width_(LS) < [mw + iw]. The truncated bits may be stored and takeninto account for rounding the output result from the circuit 500. Thisrounding may be performed by a rounding unit (not shown in FIG. 5 ).

The formatting unit 501 outputs the re-formatted significand 603 to theleft-shifter 401. Thus the shifters 401 receives as its input acontiguous set of the most significant bits of the significand. The setof most significant bits includes the leading bit of the significand(i.e. its most significant bit), but as illustrated in the examplesabove may not include some of the least significant bits of the mantissa(e.g. if the mantissa is truncated). The inputs may also include a setof leading zero bits appended, or concatenated, to the most significantbit of the significand.

The left-shifter 401 inspects the exponent to determine the valuerepresented by the ew-1 least significant bits and shifts thesignificand to the left by that amount. As described above, this resultsin the left-shifter shifting the significand to the left by (E-(B+1))bits. Thus in this example the left-shifter 401 left-shifts there-formatted significand 603 by two bits (because E-B=3) to generate ashifted result 607. The shifted result, when interpreted in the fixedpoint format, represents the value 101.10010. It is noted that theshifted result 607 is to a greater precision than that allowed for bythe fixed point format in this example. The binary logic circuit maycomprise a rounding unit configured to round the shifted result to thenumber of fractional bits set by the fixed point format to handle suchsituations. The shifted significand 607 is then output from theleft-shifter 401.

The output 607 from the shifter 401 is input to the corrector unit 509.The corrector unit is configured to increment the shift of thesignificand by one bit to the left. The result is that the significandis then correctly left-shifted by (E-B) bits. The corrector unit 509could take the form of a constant shifter configured to left-shift itsinput by one place to the left. In this case the corrector unit may havea fixed shift range of one in order to minimise the required hardwareand maximise the speed of the shifter. Alternatively the corrector unitmay be configured to append a zero bit to the least significant bit ofthe re-formatted significand 607. In order to keep the bit width of theoutput 607 constant, the corrector unit may additionally discard themost significant bit of the output 607. This process is illustrated inFIG. 6A at 609. It can be seen that appending a zero least significantbit to the output 607 and discarding its most significant bit has theeffect of left-shifting the output 607 one bit to the left. Thegenerated result 611 is then output from the corrector unit 509 andinput to the multiplexer 405.

An alternative approach to correct the left-shift is for the formattingunit 501 to append (iw-2) zero bits to the most significant bit of thesignificand, rather than (iw-1) zero bits. This as the effect ofpre-shifting the significand by one place to the left, and isillustrated in FIG. 6C.

For clarity this example uses the same significand 601 and value of trueexponent (E-B=3) as the example illustrated in FIG. 6A. The values ofmw, iw, and fw are also the same as those shown in FIG. 6A.

The significand is shown at 601. The formatting unit 501 appends (iw-2)zero bits to the most significant bit of the significand (i.e. to itsleading edge) to generate the formatted result 613. It should be notedthat appending (iw-2) zero bits to the leading edge of the significandmeans that the leading bit of the significand is no longer aligned withthe radix point (instead the significand is aligned one bit to the leftof the radix point), unlike the formatted significand shown in FIG. 6A.Thus, appending (iw-2) ‘0’ bits effectively results in an input to theleft-shifter 401 that is left-shifted by one bit relative to asignificand that is extended by (iw-1) zeros (e.g. as shown in FIG. 6A).

The formatted result 613 is then input into the left-shifter.

The left-shifter 401 inspects the (ew-1) least significant bits of theexponent to thereby left-shift the input 613 by (E-(B+1)) bits, which inthis example is 2 bits, to generate the shifted result 617. Aninspection of the shifted result 617 shows that the significand has beenleft-shifted by three bits with respect to the radix point of the fixedpoint format. That is, by appending (iw-2) ‘0’ bits to the mostsignificant bit of the significand to generate the input to the leftshifter 401, the left-shifter causes the significand to be shifted tothe left by the correct amount in accordance with the value of the trueexponent (E-B). In other words, re-sizing the significand by extendingits leading edge by (iw-2) zeros effectively introduces the extraleft-shift required to supplement the shift performed by the shifter 401(which, as described above, left-shifts the mantissa by (E-(B+1)) bits,rather than (E-B) bits in accordance with the true exponent).

Formatting the significand in this way is advantageous as it negates theneed for the corrector unit 509, therefore reducing the hardwarerequirements of the circuit. It may also enable the size of theleft-shifter to be reduced. For example, it can be seen that the widthof the left shifter in the example of FIG. 6C is width_(LS) = iw + mw-1, compared to the width of iw + mw for the case shown in FIG. 6A.

Operation of the circuit during a right-shift operation will now bedescribed.

The formatting unit 513 receives as its input the mantissa M and formatsthat input to generate a significand input to the right-shifter 403. Theformatting unit 513 may additionally receive the implicit leading bit ofthe significand as part of the significand input, or it may internallyadd this bit to the mantissa M to form the significand. The formattingunit 513 performs one or more formatting operations to format thesignificand for input to the right shifter 403. In particular, theformatting unit formats the significand to generate a second significandinput having a number of bits equal to the bitwidth of the right shifter403. An illustration of this process is shown in FIG. 6B for the case ofan unsigned number (i.e. s_(y)=0).

FIG. 6B shows the bits of the significand 601, but for this example toillustrate the operation of the right shifter the value of (E-B) = -3and so the significand is to be shifted to the right by three bits. Theinteger width iw and fractional width fw are again shown, along with thebit width of the right shifter, denoted width_(RS).

The value of width_(RS) in this example is equal to fw + 1, exploitingthe fact that, since the right shifter shifts its inputs to the right,any additional bits beyond the fw^(th) bit would not appear in theshifted result.

Thus, in this example the mantissa width and the width of the rightshifter 403 are such that (mw + 1) > width_(RS). The formatting unit maytherefore truncate a number of the least significant bits of themantissa equal to the value ((mw + 1) - width_(RS)). This would re-sizethe significand to be equal to the bitwidth of the right-shifter 403.Again, these truncated bits may be stored and taken into account forrounding the output result. This rounding may be performed by therounding unit (not shown). In this example, the formatting unittruncates the two least significant bits of the mantissa to generate thereformatted significand 623.

Formatting unit 513 outputs the reformatted significand 623 to theright-shifter 403.

The right-shifter 403 inspects the inverted exponent E to determine thevalue represented by its (ew-1) least significant bits and shifts thesignificand to the right by that amount. Thus in this example theright-shifter shifts the significand to the right by 3 bits (because(E-B) = -3) to generate the shifted result 625.

It will be noted that the formatting unit 513 does not in this exampleappend any bits to the leading edge of the significand. Because theshifter 403 only shifts to the right, it does not require any bits to beappended to the leading edge of the significand. Instead, theright-shifter 403 outputs the shifted result 625 into formatting unit511, which re-sizes the shifted result to iw+fw bits (i.e. into a numberin iw.fw format). Having the formatting unit 511 resize the shiftedresult into the fixed point format advantageously enables the bitwidthof the shifter 403 to be reduced in size.

The operation of formatting unit 511 is illustrated in FIG. 6B.Formatting unit 511 appends (iw-1) zero bits to the leading edge of thesignificand so as to align the shifted result with the radix point ofthe fixed point format. The resultant binary string is shown at 627.This generates the output result 629 sized to (iw+fw) bits. Conversely,if width_(RS) < f_(W) + 1, the formatting unit 511 appends (f_(w) + 1) -width_(RS) zero bits to the least significant bit, or trailing edge, ofthe shifted result 625 to generate an output result sized to (iw+fw)bits.

The resized shifted result 629 is then output from the formatting unit511 to the multiplexer 405.

As discussed above, shifting the significand to the right by the valuerepresented by the ew-1 least significant bits of the inverted exponentE causes the significand to be right-shifted by (B-E) bits (when B > E).Thus the right-shifter can output a correctly shifted result without acorrector unit being required between the shifter 403 and multiplexer.

In general, the multiplexer 405 therefore receives a first inputcomprising a contiguous set of bits of the output from the left-shifter,and a second input comprising a contiguous set of bits of the outputfrom the right-shifter. The first input may comprise all but the mostsignificant bit of the left-shifter output, e.g. if the corrector unit509 discards the most significant bit. Alternatively, the first inputmay be equal to the output from the left-shifter, for example if thecircuit doesn’t include corrector unit 509. The contiguous set of bitsin the second input comprises the most significant bit of the outputfrom the right shifter.

The exception-detecting circuitry 503 is configured to detect whetherthe value of the exponent would cause either underflow or overflow inthe fixed point format. Overflow will occur when E-B > iw -1 -s_(y), andunderflow will occur when (B-E) > fw. The circuitry 503 may beconfigured to analyse the exponent to detect the condition E > B +iw-1-s_(y) (the overflow condition) and/or the condition E < B - fw (theunderflow condition). The circuitry 503 could be configured to output anindication of an exception in response to detecting an exceptioncondition (e.g. the underflow and/or overflow condition). The circuitry503 may also output a first exception value, or result, in response todetecting the overflow condition, and a second exception value inresponse to detecting the underflow condition. The first exception valuecould for example be the maximum representable value in fixed pointformat. The circuitry could optionally be configured to receive the signbit of the floating point number (if the number is signed). In thiscase, the circuitry may output the maximum representable number in fixedpoint format in response to detecting that the overflow condition and ifthe sign bit indicates the number is positive, and output the minimumrepresentable number in fixed point format in response to detecting theoverflow condition and if the sign bit indicates the number is negative.

The exception-detection circuitry may additionally be configured todetect zero and infinity conditions, corresponding to when the mantissaM has a value of zero or its maximum representable value. In response todetecting the zero condition, the circuitry 503 may output zero as theexception result. In response to detecting the infinity condition, thecircuitry 503 may output an indication of infinity, or possibly NaN(not-a-number).

The exception-detection circuitry 503 may also be configured to detectdenormal inputs (i.e. inputs where Y = 0) and to treat those asexceptions. To do this, the circuitry 503 may be configured to receivethe implicit high bit ‘Y’ as an input, and to detect that the input 409is denormal in response to detecting that the Y bit has a value of zero.

The circuitry 503 outputs the indication of the exception and theexception result to the output multiplexer 505.

The output multiplexer 505 is configured to multiplex between anexception result and the output from multiplexer 405 (the shiftedresult). The multiplexer 505 may be configured to output the exceptionresult in response to receiving an indication of an exception from thecircuitry 503. If no indication of an exception is received, themultiplexer 505 outputs the shifted result received from multiplexer405. For example, the exception detection circuitry 503 may output ano-detection signal (e.g. a sequence of 0’s or 1’s) at times when noexception conditions are detected, and output the indication of anexception (e.g. a complementary signal to the no-detection signal) whenan exception condition is detected. The output multiplexer 505 couldthen output the shifted result when the no-detection signal is receivedfrom circuitry 503, and the exception result when an indication of anexception condition is received.

The exception-detection circuitry 503 may advantageously operate inparallel with the remaining components of the binary logic circuit sothat the detection of any exception conditions does not significantlydelay the operation of the circuit. Furthermore, by configuring theexception-detection circuitry to detect the overflow or underflowconditions by comparing the value of the exponent E (rather than, forexample, the true exponent (E-B)), the speed of the circuitry may beimproved. This is because the values of B, iw and fw may be pre-loadedonto the circuitry, and thus the circuitry can simply compare the valueof the variable (the exponent E) against pre-stored values. It alsoavoids the circuitry having to perform the subtraction of (E-B) todetect the underflow of overflow conditions.

A modification of circuit 500 for converting signed floating pointnumbers into fixed point format is shown in FIG. 5B. The circuit isshown generally at 500′, with the signed floating point number to beconverted being shown at 517. The circuit comprises a negating unitshown at 515. The negating unit 515 receives as an input the mantissa Mand sign bit. It could internally add the implicit high bit Y to formthe significand, or otherwise receive this bit as an input. The outputfrom the negating unit 515 could be a signed number in the form SY.M,where S denotes the sign bit, Y denotes the high bit of the significandand M denotes the mantissa.

The output SY.M is fed as an input to the formatting unit 501. In thecase of post-shift correction by corrector unit 509, the formatting unit501 operates to append (iw - 2) sign bits to the leading bit of thenumber SY.M outputted by negating unit 515 to generate the input to theleft-shifter 401. Thus, in general, for the case of post-shiftcorrection the formatting unit may operate to append (iw-1-s_(y)) bitsto the leading bit of its received input, where the s_(y) = 1 and theappended bits are sign bits for signed floating point numbers, and s_(y)= 0 and the appended bits are zero bits for unsigned floating pointnumbers.

In the case of pre-shift correction, the formatting unit 501 operates toappend (iw - 3) sign bits to the leading bit of the signed numberoutputted by the negating unit 515 to generate the input to the leftshifter 401. Thus, in general, for the case of pre-shift correction theformatting unit may operate to append (iw - 2 - s_(y)) bits to theleading bit of its received input, where the s_(y) = 1 and the appendedbits are sign bits for signed floating point numbers, and s_(y) = 0 andthe appended bits are zero bits for unsigned floating point numbers.

The formatting unit 513 receives the signed number SY.M from thenegating unit, and may truncate a number of the least significant bitsof the mantissa equal to the value ((mw + 1 + 1) - width_(RS)) when themantissa width is such that (mw + 1 + 1) > width_(RS). Thus, in general,the formatting unit 513 may truncate a number of least significant bitsof the mantissa equal to the value [(mw + 1 + s_(y)) - width_(RS))] when(mw + 1 + s_(y)) > widthRS. In the case of signed numbers, the width ofthe right shifter may be set to (1 +fw+1). Thus, in general, the widthof the right shifter 403 may be equal to (1+fw+s_(y)), where s_(y) = 0for unsigned numbers and s_(y) = 1 for signed numbers

For signed floating point inputs, the formatting unit 511 may operate toappend (iw -2) sign bits to the leading bit of the output from the rightshifter 403. Thus, in general, the formatting unit 511 may append (iw -1 - s_(y)) bits to the leading bit of the right shifter output, wherethe s_(y) = 0 and the appended bits are zero bits in the case ofunsigned floating point inputs, and s_(y) = 1 and the appended bits aresign bits in the case of signed floating point inputs.

In an alternative arrangement of circuit 500′, the negating unit 515could be arranged between the formatting units 501, 513 and the left andright shifters, so that the negating unit receives as its inputs theoutputs of the formatting units, and outputs its values to the left andright shifters.

A number of optimisations may be made to minimise the bit width of theshifters 401, 403 and/or their shift range for the circuits 500 and 500′In the following, it is noted that s_(y) = 0 for unsigned floating pointnumbers, and s_(y) = 1 for signed floating point numbers.

It has been appreciated that the maximum amount by which the significandcan be shifted is governed either by the size of the integer widths iwand fw or the exponent width ew. Considering the left-shift case first,it is noted that the value (iw-1-s_(y)) represents the maximum amount bywhich the significand can be left-shifted before overflow occurs giventhe fixed point format. The value 2^(ew-1) - 1 represents the maximumleft-shift as determined from the true exponent E-B and occurs when E =2^(ew)-2 (E=2^(ew)-1 being an exception result). Thus, if 2^(ew-1) - 1≤iw-s_(y)-1, then the maximum left-shift is governed by the exponentwidth and overflow does not occur even when the true exponent takes itsmaximum value. Conversely, if iw-s_(y)-1 < 2^(ew-1) - 1, then theexponent is capable of taking values that would cause overflow to occur(i.e. that would cause the most significant bit of the result to beshifted out of the fixed point format). In this case the maximumleft-shift is governed by the value (iw-s_(y)-1). Thus, if overflow ishandled as an exception result, the left-shift range can be limited tothe minimum of: iw-1-s_(y); and ii) 2^(ew-1)-1.

However, the total left-shift to which the significand is subjected isformed of two components: i) the shift performed by the shifter 401; andii) the single shift correction (applied either pre or post shift).Thus, the range of the shifter 401 can be limited to one less than thevalue of the total left-shift range. In other words, the shifter 401 canbe optimised by limiting its shift range to the minimum of: i)iw-2-s_(y); and ii) 2^(ew-1)-2. It is noted that, as used herein, ashift range of ‘n’ is taken to mean a shifter is capable of shifting aninput from 0 up to and including n bits. In other words, the shifter 401may be configured to shift its inputs by any value in the range 0 -min[(iw-2-s_(y)), 2^(ew-1)-2]. This ensures the total left-shift of thesignificand is limited to the minimum of iw-1-s_(y) and 2^(ew-1)-1 oncethe shift correction has been applied.

It may be advantageous to limit the range of the shifter to minimise itshardware requirements and maximise its speed. For example, some shifters(for example barrel shifters) may comprise one multiplexer per bit ofthe shift-range bitwidth. The bitwidth of the shifter may refer to thenumber of bits required to represent the range of the shifter. Forexample, if a shifter has a shift-range of 255 bits, the shifterrequires 8 bits to cover this range; i.e. an 8-bit shifter is capable ofshifting an input by a maximum of 255 bits. If the shift range islimited, the number of multiplexers forming the shifter may bedecreased, which in turn may increase the speed of the shifter.

If overflow cannot occur even when the exponent takes it maximum value,then the left shifter 401 may be configured to left-shift thesignificand by a number of bits equal to the value represented by theew-1 least significant bits of the exponent.

If overflow can occur (i.e. if iw-s_(y-)1 < 2^(ew-1) - 1), then theleft-shifter need only inspect the k least significant bits of theexponent to determine the shift, where k= bitwidth(iw - s_(y)-2) =ceiling{log₂(iw-s_(y)-1)}. In general, bitwidth(n) =ceiling{(log₂(n+1)}, where bitwidth(n) is the function that gives thenumber of bits required to represent a value in the range of 0 up to n(i.e., n+1 different values). It is noted that k = bitwidth(iw-s_(y)-2), rather than bitwidth(iw - s_(y) - 1), due to the additionalcorrection applied to the left shift (applied either pre-or-postcorrection).

The shifter 401 does not need to know the values of the (ew-k) mostsignificant bits of the exponent because if any of those bits arenon-zero, then the value of the true exponent (E-B) would cause overflowanyway (and so may be handled separately as an exception result). Forcases where all of the (ew-k) most significant bits of the exponent arezero, then the same shift value is obtained from inspecting k leastsignificant bits as from inspecting >k least significant bits.

Of course, the left-shifter may be configured to inspect (ew-1) bits ofthe exponent regardless of the values of ew and iw (with overflowconditions being handled by exception-detection circuitry). Thus ingeneral, in order for the shifter 401 to give the correct shift result kis at least equal to the minimum of: i) (ew-1); and ii) bitwidth(iw-2-s_(y)), but it is noted that the circuit may be optimised byconfiguring the left-shifter to shift its inputs to the left by thevalue represented by k least significant bits of the exponent E, where k= ew-1 when 2^(ew-1) - 1≤ iw-s_(y)-1, and k = bitwidth(iw-s_(y)-2) wheniw-S_(y)-1 < 2^(ew-1) - 1.

The values of the integer width iw, fractional width fw and mantissawidth mw can also be exploited to optimise the width width_(LS) of theleft shifter 401.

With reference to FIG. 6A, it can be appreciated that, for the case ofpost-shift correction (e.g. by corrector unit 509), if mw ≤ fw, thevalue of width_(LS) can be reduced to iw′+mw, where iw′ is the maximumamount the significand can be left-shifted, i.e. iw′ = min{(iw-1-s_(y)),2^(ew-1)-1}. Conversely, if mw > fw, the value of width_(LS) can bereduced to (iw′ + fw + iw′)(i.e. the output range plus the shift range).Thus, the width of the shifter can be optimised by noting thatwidth_(LS) = iw′ + min(mw, (fw+iw′)).

For the case of pre-shift correction (i.e. when the maximum left-shift,iw″ = min[(iw-2-s_(y)), 2^(ew-1)-2], if mw ≤ fw + 1 then the shifterwidth width_(LS) can be reduced to iw″ + mw. Conversely, if mw > fw+1,then the shifter width width_(LS) can be reduced to (iw″ + fw + iw″.Thus for the case of pre-shift correction the width of the shifter canbe optimised by noting that width_(LS) = iw″ + min(mw, (fw + iw″).. Itwill be noted that the width of the left shifter can therefore bereduced when pre-shift shift correction is applied compared to whenpost-shift shift correction is applied.

Turning now to the right-shift case, it has been appreciated that themaximum amount by which the significand can be right-shifted beforeunderflow occurs is fw. The maximum right shift as governed by the trueexponent (E-B) is 2^(ew-1) - 2, which occurs when E=1 (E=0 being anexception result). The exponent width may govern the maximum right-shiftwhen 2^(ew-1) - 2 ≤ fw, i.e. when underflow cannot occur even when theexponent takes its minimum value. Conversely, if fw < 2^(ew-1) - 2 thenthe exponent is capable of taking values that would cause underflow tooccur. In this case the maximum right-shift is governed by the value fw.

If underflow cannot occur even when the exponent takes its minimumvalue, then the right-shifter 403 may be configured to right-shift thesignificand by a number of bits equal to the value represented by theew-1 bits of the inverted exponent.

If underflow can occur (i.e. if fw < 2^(ew-1) - 2), then theright-shifter need only inspect the p least significant bits of theinverted exponent to determine the shift, where p = bitwidth(fw). Theright-shifter 403 does not need to know the values of the (ew-p) mostsignificant bits of the inverted exponent because in the event that anyof those bits are non-zero, the value of the true exponent would causeunderflow anyway (and so may be handled separately as an exceptionresult). If all of the (ew-p) most significant bits of the invertedexponent are zero, then the same right-shift value is obtained frominspecting p least significant bits as from inspecting >p leastsignificant bits.

The right-shifter may be configured to inspect (ew-1) least significantbits of the inverted exponent regardless of the values of ew and fw(since this will give the correct amount by which to shift right), andthus in general for the shifter 403 to give the correct result p isgreater than or equal to the minimum of: i) (ew-1); and ii) bitwidth(fw), but it is noted the circuit may be optimised by configuring theright-shifter to right-shift its inputs by the value represented by pleast significant bits of the inverted exponent, where p = ew-1 when2^(ew-1) - 2 ≤ fw and p = bitwidth(fw) when fw < 2^(ew-1) - 2.

Similarly to the left shifter, the range of the right shifter may belimited to the maximum right shift. Thus for floating and fixed pointformats where 2^(ew-1) - 2 ≤ fw, the range of the right shifter 403 maybe limited to the value of 2^(ew-1) - 2 because the right shifter wouldnot need to shift any more than this value regardless of the exponentvalue. If instead the floating and fixed point formats were such that fw< 2^(ew-1) - 2 then the range of the shifter may be limited to the valueof fw (there being no need to shift any more than this otherwiseunderflow would occur). Thus right-shifter 403 may be optimised bylimiting its shift range to the minimum of: i) 2^(ew-1)-2; and ii) fw.

The values of the mantissa width mw, exponent width ew and thefractional width fw can be exploited to optimise the width width_(RS) ofthe right shifter 403.

With reference to FIG. 6B, it can be appreciated that, when mw > fw, thevalue of width_(RS) can be reduced to (1 +s_(y)+fw). If mw < fw, thevalue of width_(RS) can be set to (1 +s_(y)+mw+2^(ew-1) - 2), which mayor may not exceed the value (1 +s_(y)+fw) depending on the values of mw,ew and fw. Thus, it has been appreciated that the size of theright-shifter can be optimised by noting that width_(RS) = (1+s_(y)) +min(fw, mw + 2^(ew-1) -2).

A binary logic circuit may not necessarily have both exception-detectioncircuitry and a corrector unit: the circuit may for example have acorrector unit and/or exception-detection circuitry. It may have neithercomponent. The formatting units may be included within the binary logiccircuit (as shown in the examples herein), but in other examples thebinary logic circuit may not include formatting units. In such cases thebinary logic circuit may be configured to receive appropriatelyformatted significands directly. Those inputs could be input directlyinto the left and right shifters.

The binary logic circuits described above may offer performanceadvantages over conventional floating-point-to-fixed-point conversioncircuits. For example, for unsigned numbers, the mantissa may be subjectto little or no computational logic (e.g. negation) before beingshifted. In this case, the performance of conventional conversioncircuits may be limited by the delay in subtracting the bias from theexponent to determine the significand shift. The circuits describedabove remove this subtraction by determining the significand shift fromthe exponent, and therefore overcome this performance limitation.

Another situation for which the binary logic circuits may beparticularly well suited is for converting a signed number to fixedpoint format with a round-to-zero (RTZ) rounding mode. For RTZ roundingmode, it is preferable that the negation of the significand is performedafter the significand has been shifted in order to produce the correctlyrounded result. Thus although the number may be signed, there may belittle or no computational logic in the path of the significand beforethe shifter, and thus avoiding the subtraction of the bias from theexponent may offer improved circuit performance compared to conventionalconversion circuits.

Single-Path Shifter

FIG. 7 shows a further example of a binary logic circuit 700 forconverting a binary number in floating point format to fixed pointformat.

The binary logic circuit comprises a right-shifter 701, a formattingunit 715, an offset unit 703 and a negating unit 705. The shifter 701 iscoupled to the offset unit 703 and the formatting unit 715. The shifterhas a width denoted width_(RS)′. The formatting unit is coupled to thenegating unit. The floating point number to be converted is shownschematically at 707 and comprises a sign bit S 709, an exponent field711 of ew bits representing the exponent E and a mantissa field 713 ofmw bits representing the mantissa M. The exponent is biased by anexponent bias B, given in this example by B=2^(ew-1) - 1. The trueexponent of the floating point number is given by (E-B). The floatingpoint number therefore represents the value given by (-1)^(sign) x2^(E-B) × significand = (-1)^(sign) × 2^(E-B) × Y.M, where Y is theleading bit of the significand, M is the mantissa, and Y = 1 for anormal floating point number and Y = 0 for a denormal floating pointnumber. The fixed point format has an integer part of iw bits and afractional part of fw bits such that the number in fixed point format isgiven by iw.fw, with iw and fw being separated by a radix point.

The negating unit 705 is configured to receive the mantissa M and to addthe implicit high bit Y to form the significand. In an alternativeexample the negating unit may receive both the mantissa and the highbit. The negating unit is further configured to receive the sign bit 709and to negate the significand in dependence on the value of the signbit. The negating unit is further configured to append the sign bit tothe leading edge of the significand to generate a signed output in theform SY.M, where SY are the bits before the radix point and representthe two-most significant bits of the number: the sign bit S and theimplicit bit Y of the mantissa. Thus, the signed output comprises thesign bit appended to the leading bit of the significand. The signedoutput may be a bit-string comprising only the sign bit and significandbits. The negating unit may negate the significand by taking thecomplement of the significand. In this example, the negating unit isconfigured to negate the significand if the sign bit has a value of ‘1’,and to not negate the significand if the sign bit has a value of ‘0’.The output of the negating unit is fed as an input to the formattingunit 715.

The formatting unit 715 is configured to receive the signed significandand to perform one or more formatting operations. The formattingoperations may include, for example, re-sizing the significand toproduce a bit string with a number of bits suitable for use with theright-shifter 701. The significand may be re-sized to a number of bitsequal to the bit width of the shifter width_(RS)′, for example. There-sizing operations may include appending one or more zero bits to theleast significant bit of the mantissa (e.g. if the value (1 + s_(y) +mw) is less than the bit width of the shifter 701), or truncating one ormore of the least significant bits of the mantissa (e.g. if the value(1 + s_(y) + mw) is greater than the bit width of the shifter 701). Inparticular, if (1 + s_(y) + mw) > width_(RS)′, then the formatting unitmay truncate the [(1 + s_(y) + mw) - width_(RS)′] least significant bitsof the significand; if (1 + s_(y) + mw) < width_(RS)′, the formattingunit may append [width_(RS)′ - (1 + s_(y) + mw)] zero bits to thetrailing edge of the significand.

The right shifter 701 therefore receives as its input a formatted set ofthe significand bits. The significand bits may have been formatted inthe sense that a sign bit has been appended to the most significant bit,and/or that the significand has been re-sized. Alternatively or inaddition, the bits may be formatted in the sense that they have beennegated in dependence on the value of the sign bit. The formatted set ofbits may comprise all the bits of the significand (e.g. if no bits aretruncated), or alternatively it may comprise only a subset of contiguousbits including the most significant bits (e.g. if a number of leastsignificant bits are truncated during re-sizing). The most significantbits may include the sign bit and the implicit leading bit Y.

The formatted set of bits form the input to the right-shifter 701, whichmay be referred to as a significand input. The input is then shifted bythe shifter to transform the number to fixed point format given byiw.fw.

The offset unit 703 is configured to offset the exponent E of thefloating point number to generate a shift value s_(v) used by theshifter 701 to shift the signed number. The offset unit 703 outputs theshift value s_(v) to the shifter 701. The shift value is a valuerepresented by sw bits. By offsetting the exponent in a suitable manner,the binary logic circuit is capable of converting floating point numbersto fixed point format for both positive and negative values of the trueexponent (E-B) using a single shifter capable of shifting in a singledirection only.

In this example, the offset unit is configured to receive the exponent Eand to offset the exponent E by a value equal to the maximum amount bywhich the mantissa (or equally, the signed number SY.M) can beleft-shifted before overflow occurs in the fixed point format (i.e.before the most significant bit of the number is shifted out of theresult). In this example, because the number is signed, the offset unitoffsets the exponent E by the value (iw-2) to generate the shift value.If the number were unsigned, the offset unit may offset the exponent bythe value (iw-1). Thus, in general the offset unit may be offset theexponent by the value (iw-1-s_(y)), where s_(y) = 1 for a signed numberand s_(y) = 0 for an unsigned number.

The offset unit offsets the exponent to generate the shift value s_(v) =((B-E) + (iw-1-s_(y))). The shifter 701 is then configured toright-shift the signed number by a number of bits equal to the values_(v) to generate a shifted result, and to shift in s_(v) sign bits.That is, the shifter 701 replicates the sign bit S to fill the vacantpositions introduced by each right shift. Configuring the shifter inthis way enables a number in floating point format to be converted tofixed point format for both positive and negative values of the trueexponent (E-B). To demonstrate this, various examples for shifting asigned number will now be described with reference to FIG. 8 .

In these examples the formatted significand is in the form of a signednumber SY.M. That is, in this example for the purposes of clarity thesignificand has not also been re-sized.

The signed number SY.M is shown at 800 and comprises the sign bit 801,implicit leading bit Y of the significand 803, and the mw bits of themantissa M 805. The number 800 is to be interpreted such that theleading bit of the significand Y and fractional bits M are separated bythe radix point. The number is shown with the radix point aligned withthe radix point separating the integer and fractional parts of the fixedpoint format, where in this example iw = 4 bits and fw = 5 bits. Thesigned number re-interpreted as a number in the form iw.(mw-iw+1+s_(y))is shown at 807. Number 807 is to be interpreted such that the leadingiw bits and the trailing (mw-(iw-1-s_(y))) bits are separated by a radixpoint. Note that the bits forming the number 807 are identical to thoserepresenting the number 800- it is what those bits represent that istaken to be different for the purposes of illustration.

Now, as a first example, consider the case in which the value of thetrue exponent is equal to 0, so the floating point number represents thevalue (-1)^(sign) × Y.M.It follows the value of s_(v) = iw-2 = 2. Thus,if the true exponent is equal to 0, the right-shifter shifts the signednumber to the right by 2 bits to generate the shifted result shown at809. Because in this example the input number 800 is signed, the rightshifter shifts in s_(v) sign bits (in this example, two sign bits). Thetwo least significant bits of the mantissa have been shifted out of theresult 809. Of course, the number of bits shifted out of the resultdepends on the shifter width, which has been chosen to be equal to(iw+fw+2) in these examples merely for illustration. It can be seen thatthe leading bit of the significand Y and the mw-2 remaining fractionalbits of the mantissa are separated by the radix point when interpretedin the fixed point format iw.fw, and thus the shifter 701 has given thecorrect result.

As another example, if the value of the true exponent (E-B) is equal to-fw (so that the leading bit Y of the significand is the leastsignificant bit of the shifted number in iw.fw format), the value ofs_(v) = ((B-E) + (iw-1-1))= (fw + iw - 2) = 7. That is, if the value ofthe true exponent is equal to -fw, the shifter 701 shifts the signednumber 801 to the right by (fw+ iw - 2) bits to generate the shiftedresult shown at 811. It can be seen that leading bit Y of thesignificand is the least significant bit of the result in fixed pointformat, and thus the shifter 701 has again given the correct result. Theseven least significant bits of the mantissa have been shifted out ofthe result in this example, and the right-shifter has shifted in 7 signbits.

For a final example, consider the case where the value of the trueexponent is equal to iw-2 (so that the sign bit 801 is the mostsignificant bit of the shifted number in fixed point format). In thiscase, the value of s_(v) = 0 and so the shifter 701 doesn’t shift thesigned number 801 and thus the most significant bit of the signed number(i.e. the sign bit) is also the most significant bit of the shiftedresult 813.

Offsetting the exponent bias by a value equal to the maximum left-shiftbefore overflow occurs may be viewed conceptually as left-aligning theformatted significand (e.g. the signed number SY.M) with the fixed pointformat (i.e. aligning the sign bit, or most significant bit, of thenumber with the most significant bit of the fixed point format).

The shifted result output from the shifter 701 may be taken as the fixedpoint number.

The shifter 701 may be optimised by exploiting knowledge of the floatingpoint and fixed point formats.

The shifter 701 may be optimised by limiting its shift range. It will beappreciated from FIG. 8 that the maximum value the shifter 701 can shiftto the right by before underflow occurs (i.e. before the leading bit ofthe mantissa is shifted out of the result) is (iw+fvv-1-sy) bits. Incertain cases however the maximum amount the shifter 701 will need toshift right by will be limited by the exponent, not the size of thefixed point format. More specifically, the maximum amount by which thesignificand can be left-shifted in accordance with the exponent is whenE = 2^(ew)-2 (E = 2^(ew-1) being an exception result), giving a maximumleft-shift of (E-B)max = 2^(ew)-2 - (2^(ew-1)-1) = 2^(ew-1)-1 = B. Thuswhen 2^(ew-1)-1 ≤ (iw-1-s_(y)), overflow cannot occur. Conversely, when2^(ew-1)-1 > (iw-1-s_(y)), the exponent is capable of taking values thatcause overflow and thus the maximum left shift is limited to(iw-1-s_(y)). The maximum left-shift is therefore equal to the minimumof: i) 2^(ew-1)-1 and ii) (iw-1-s_(y)).

The maximum right shift before overflow occurs is equal to thefractional width, fw. The maximum right-shift governed by the exponentoccurs when E=1 (E=0 being an exception), giving a right-shift of2^(ew-1)-2 (=B-1). The maximum right-shift is therefore equal to theminimum of: i) fw and ii) 2^(ew-1)-2.

Thus, the total shift range of the shifter 701 can be minimised to:min(2^(ew-1)-1, iw-1-s_(y)) + min(fw, 2^(ew-1)-2). This is advantageousbecause reducing the range of the shifter may improve its speed byreducing the number of required multiplexers, as described above.

It follows that if the shift range of shifter 701 can be optimised, theshifter 701 need only inspect the k′ least significant bits of the shiftvalue s_(v), where k′ = bitwidth[min(2^(ew-1) - 1, iw - 1 - s_(y)) +min(fw, 2^(ew-1) - 2)]. Inspecting these k′ least significant bitsensures that the minimum number of bits of the shift value s_(v) areinspected in order to cover the shift range of the shifter 701.

Of course, in some examples k′ may be equal to the bit width of s_(v)regardless of the floating point and fixed point formats. In this case,values of the shift value s_(v) which would cause overflow to occurwould be handled as exceptions by exception-handling circuitry.

Thus, in general bitwidth[min(2^(ew-1) - 1, iw - 1 - s_(y)) + min(fw,2^(ew-1) - 2)] ≤ k′ < sw.

It also follows that if the range of the shifter 701 is optimised, thebit width of the shifter, width_(RS)′, may also be optimised. It can beseen with reference to FIG. 8 that if mw > (iw+fw-(1+s_(y))), then thewidth of the shifter is optimised by setting it equal to iw+fw. If onthe other hand mw < iw+fw-(1+s_(y))), the minimum width of the shifteris equal to (1+s_(y) + mw) plus the minimum shift range of the shifterif the total width is smaller than iw+fw, i.e. width_(RS)′= (1+s_(y) +mw) + min(2^(ew-1) - 1, iw - 1 - s_(y)) + min(fw, 2^(ew-1) - 2)_(.) Thusin general, the bit width of the shifter 701 can be minimised as:width_(RS)′ = min[(/w+fw), (1+s_(y) + mw) + min(2^(ew-1) - 1, iw - 1 -s_(y)) + min(fw, 2^(ew-1) - 2)].

An alternative example of a single-shifter binary logic circuit is shownin FIG. 9 . In this example the binary logic circuit comprises a singleshifter configured to shift to the left only.

As shown in FIG. 9 , the binary logic circuit 900 comprises aleft-shifter 901, an offset unit 903, a negating unit 905 and aformatting unit 907. The shifter 901 is coupled to the offset unit 903and the formatting unit 907, and has a bitwidth denoted width_(LS)′. Thenegating unit 905 is coupled to the formatting unit 907.

The floating point number is shown schematically at 707 and againrepresents the value given by (-1)^(sign) × 2^(E-B) × significand =(-1)^(sign) × 2^(E-B) × Y. M, where Y is the leading bit of thesignificand, M is the mantissa, and Y = 1 for a normal floating pointnumber and Y = 0 for a denormal floating point number. The fixed pointnumber to which the floating point number is to be converted comprisesan integer part of iw bits and a fractional part of fw bits.

The offset unit 903 is configured to offset the exponent E of thefloating point number to generate a shift value s_(v) used by theshifter 901 to left-shift the signed number. The offset unit outputs theshift value to the shifter 901. By suitably offsetting the exponent biasB, the binary logic circuit 900 is capable of converting floating pointnumbers to fixed point numbers for both positive and negative values ofthe true exponent (E-B) using a single shifter capable to shifting tothe left only.

The offset unit 903 is configured to receive the exponent E and tooffset it by a value equal to the maximum amount by which the formattedsignificand (e.g. signed number SY.M) can be shifted to the right beforeunderflow occurs. In this case the offset unit is configured to offsetthe exponent E by fw to generate a shift value given by s_(v) = (E - B +fw). The value s_(v) is then input to the shifter 901. The shift values_(v) has a bit width of sw bits.

The negating unit 905 is configured to receive the mantissa M and thesign bit 709. The negating unit may additionally receive the implicithigh bit of the significand or it may internally append this to theleading edge of the mantissa to form the significand. The negating unitmay further be configured to append the sign bit to the leading edge ofthe significand to generate a signed output in the form SY.M. Thenegating unit takes the complement of the significand in dependence onthe value of the sign bit 709. In this example, the negating unit isconfigured to negate the significand if the sign bit has a value of ‘1’,and to not negate the significand if the sign bit has a value of ‘0’.The signed output comprises a sign bit appended to the leading bit ofthe significand. The signed output may be a bit string comprising onlythe sign bit and the significand. The signed output is fed as an inputto the formatting unit 907.

The formatting unit 907 is configured to receive the signed outputSY.Mand to perform one or more formatting operations. The formattingunit is configured to append (iw+fw-(1 +s_(y))) sign bits to the mostsignificant bit of the signed number SY.M (where s_(y) = 1 because theinput number 707 is signed). This effectively right-aligns thesignificand to the fixed point format, i.e. the leading bit (theimplicit high bit Y) of the significand is aligned with the leastsignificant bit of the fixed point format. In other words, in theformatted significand, the leading bit of the significand is the fw^(th)most significant bit. An example of a formatted signed number SY.M isshown in FIG. 10 at 1001. The formatting operations may further comprisere-sizing the significand to produce a bit string with a number of bitssuitable for use with the left-shifter 901. The significand may bere-sized to a number of bits equal to the bit width of the shifter, forexample. In particular, if (iw+fw+mw) > width_(LS)′, then the formattingunit may truncate the [(iw+fw+mw)-width_(RS)′] least significant bits ofthe significand. Alternatively, if width_(LS)′ > (iw+fw+mw), theformatting unit may append [width_(LS)′-(iW+fW+mw)] zero bits to thetrailing edge of the significand.

The left shifter therefore receives as its input a formatted set of thesignificand bits. The significand bits may have been formatted in thesense that (iw+fw-(1+s_(y))) sign bits have been appended to the mostsignificant bit, and/or that the mantissa has been re-sized.Alternatively, or in addition, the bits may be formatted in the sensethat complement of these bits has been taken in accordance with thevalue of the sign bit. The formatted set of bits may comprise all thebits of the signed number SY.M (e.g. if no bits are truncated), oralternatively it may comprise only a subset of contiguous bits includingthe most significant bits (e.g. if a number of least significant bitsare truncated during re-sizing). The most significant bits may includethe sign bit and the leading bit Y.

The shifter 901 is configured to shift to the left only. It isconfigured to receive as an input the formatted set of bits output fromthe formatting unit 907 and the shift value _(Sv) from the offset unit903. The shifter is configured to left-shift the signed number by anumber of bits equal to s_(v) = (E - B + fw). Configuring theleft-shifter in this manner allows a number to be converted to fixedpoint format for positive and negative values of the true exponent (E-B)using a single shifter. To illustrate this, a number of examples willnow be described with reference to FIG. 10 , in which again iw = 4 andfw = 5.

An example of a formatted significand received by the left-shifter 901is shown at 1001. It comprises the leading (iw+fw-(1+s_(y))) appendedsign bits, denoted 1003, the sign bit S, denoted 1005, the implicitleading bit Y, denoted 1007, and the fractional mantissa bits M, denoted1009. The integer and fractional widths of the fixed point number arealso shown for illustrative purposes. In this example the mantissa hasnot been re-sized by truncating, or appending zero bits to, its leastsignificant bits.

Consider a first example in which the value of the true exponent isequal to 0, so that the floating point number represents the value(-1)^(sign) × 2⁰ × Y.M and the value of s_(v) = s_(v) = (E - B + fw) =fw. The left-shifter 901 is configured to left-shift the number 1001 tothe left by fw bits to generate the shifted result 1011. It can be seenthat the shifted result is correctly aligned with respect to the fixedpoint format, i.e. the sign bit and leading significand bit form theinteger part of the fixed point number, and the M mantissa bits form thefractional part of the fixed point number. Interpreted as a fixed pointnumber in the format Siw.fw, the shifted result 1011 represents thenumerical value Y. M (excluding the sign bit). The binary logic circuit900 has therefore provided the correct result. Shifter 901 outputs theshifted result 1011.

Consider a second example in which the value of the true exponent isequal to -fw, so that the value of s_(v) = 0. In this case theleft-shifter 901 shifts the signed number to the left by 0 bits (i.e.the signed number is not shifted) to generate the result 1013, which isoutput from the shifter 901. Thus in this case the most significant bitof the significand (the implicit leading bit Y) corresponds to the leastsignificant bit of the fixed point number in Siw.fwformat. Result 1013represents the minimum value of the fixed point number before theleading significand bit is shifted out of the fixed point result andunderflow occurs.

For the third example consider the case where the true exponent is equalto (iw-2) so that the floating point number represents the value(-1)^(sign) x 2^(iw-2) x Y.M. The shift value generated by the offsetunit is therefore given by s_(v) = iw+fw-2. Thus in this case theleft-shifter 901 left-shifts the formatted significand 1001 by (iw+fw-2)bits to generate the shifted result 1015. Result 1015 is then outputfrom the shifter 901. In this case the most significant bit of thesignificand 1001 (the sign bit) corresponds to the most significant bitof the fixed point result in iw.fw format. Result 1015 thereforerepresents the maximum value of the fixed point number before the signbit is shifted out of the result and overflow occurs.

Offsetting the exponent bias by the fractional width fw may be viewedconceptually as right-aligning the significand with the fixed pointformat so that the leading bit of the significand is aligned with theleast significant bit of the fixed point format.

Similarly to the single shifter circuit shown in FIG. 7 , the shifter901 may be optimised by exploiting knowledge of the floating point andfixed point formats. One way in which the shifter may be optimised is tominimise the shift range. The shift range may be optimised in the samemanner as shifter 701 described above. In particular, it has beenappreciated that the optimised range of the shifter 901 is equal to themaximum upshift (limited either by the exponent width ew or integerwidth iw) plus the maximum downshift (limited either by the exponentwidth ew or fractional width fw). The optimised shift range of theshifter 901 is thus the same as the optimised shift range of the shifter701 and is equal to: min(2^(ew-1)-1, iw-1-s_(y)) + min(fw, 2^(ew-1)-2).

It follows that if the shift range of the shifter 901 can be optimised,the shifter 901 need not necessarily inspect all sw bits of the shiftvalue s_(v), but only the k″ least significant bits, where k″ =bitwidth[min(2^(ew-1) - 1, iw - 1 - s_(y)) + min(fw, 2^(ew-1) - 2)].Inspecting these k″ least significant bits ensures that the minimumnumber of bits of the shift value s_(v) are inspected in order to coverthe shift range of the shifter 901. The (sw-k″) most significant bits ofthe shift value need not be inspected because if any of those bits werenon-zero, the shift value would cause overflow to occur (and so behandled as an exception result).

Of course, the value of k″ may be set equal to the bit width of theshift value s_(v) regardless of the floating point and fixed pointformats. In this case, values of the shift value s_(v) which would causeoverflow to occur would be handled as exceptions by exception-handlingcircuitry.

Thus, in general, bitwidth[min(2^(ew-1) - 1, iw - 1 - s_(y)) + min(fw,2^(ew-1) - 2)] < k″ ≤ sw.

Knowledge of the optimised shift range can also be exploited to minimisethe size of the shifter 901 (i.e. its bitwidth). The bitwidth of theshifter 901, denoted width_(LS)′, can be minimised by setting it equalto the range of the output number in fixed point format plus the minimumshift range. The optimised width of the shifter is thus width_(LS)′ =iw + fw + min(2^(ew-1)-1, iw-1-s_(y)) + min(fw, 2^(ew-1)-2). Optimisingthe bitwidth of shifter 901 advantageously allows the hardwarerequirements of the shifter to be reduced.

The above examples described with reference to FIGS. 7 to 10 serve toillustrate how a binary logic circuit can be configured to convert anumber in floating point format to fixed point format using only asingle shifter. Although not shown, the binary logic circuits 700 and900 may further comprise a rounding module configured to round theresult output from the shifters. The rounding modules may be configuredto round the output from the shifters to fw fractional bits. Therounding modules may be configured to implement one of the followingrounding modes: round-to-zero; round-to-nearest-even;round-to-negative-infinity; round-to-positive infinity.

Binary logic circuits 700 and 900 may also further compriseexception-handling circuitry (e.g. exception detection circuitry 503).That exception handling circuity may be configured to detect one or bothof an overflow condition and an underflow condition, as described abovefor circuitry 503. The circuits 700, 900 may additionally comprise amultiplexer (e.g. output multiplexer 505) that multiplexes between anexception result output from the exception-handling circuitry and theresult output from the shifter.

Binary logic circuits 700 and 900 have been described as including anegating unit that outputs a result to a formatting unit. In analternative arrangement, the negating unit may be arranged downstream ofthe formatting unit so that the formatting unit outputs a result to thenegating unit, with the negating unit then generating the input to theshifter. Alternatively still, the negating unit could be arrangeddownstream of the shifter, so that the output of the shifter is inputinto the negating unit. The circuits have also been described asoperating on signed numbers. The circuits 700 and 900 could be adaptedto work on unsigned numbers. In this case, the circuits need notcomprise the negating units 705 and 907. Furthermore, for unsignednumbers the formatting unit 905 may append (iw + fw-1 ) zero bits to theleading bit of the significand. Thus, in general, the formatting unit905 appends (iw + fw - (1 +s_(y))) bits to the leading bit of thesignificand, where s_(y) = 1 and the appended bits are sign bits forsigned floating point numbers, and s_(y) = 0 and the appended bits arezero bits for unsigned floating point numbers.

The single-shifter circuits described above with reference to FIGS. 7 to10 may offer performance advantages over conventionalfloating-point-to-fixed-point conversion circuits. For example, byutilising a single shifter configured to shift in a single directiononly, the need to negate the shift (e.g. if the true exponent isnegative) is avoided. Furthermore, for some floating point and fixedpoint formats, the delay of the single shifter is less than the delayassociated with that of split-path shifters and the associatedmultiplexer. This may offer performance advantages when the number to beconverted to fixed point format is signed. This is explained in moredetail below.

The delay associated with a shifter is related to its bit depth, i.e.the bit width of its shift range. The bit depth of the right-shifter 701and left-shifter 901 is bitwidth[min(2^(ew-1) - 1, iw - 1 - s_(y)) +min(fw, 2^(ew-1) - 2)] = ceil{log₂ [1 + min(2^(ew-1) - 1, iw - 1 -s_(y)) + min(fw, 2^(ew-1) - 2)]}. For a split-path shifter, theleft-shifter has a bit depth of ceil[log₂(1 + (iw - 1 - s_(y)))] =ceil[log₂(iw - s_(y))], and the right shifter a depth of ceil[log₂(1 +(1 + fw))] = ceil[log₂(2 + fw)]. The total delay of the split-pathcircuit is equal to the larger of the shifter delays plus the delay ofthe multiplexer, which may typically be about the same as the larger ofthe shifter delays. For example, if iw = 7 and fw = 16 and the number isunsigned (i.e. s_(y)=0), the depth of the single shifter isceil[log₂(1 + (7 - 1) + 16) = ceil[log₂ 23] = 5, while for thesplit-path circuit the depths of the left and right shifters areceil[log₂(1 + (7 - 1))] = 3 and ceil[log₂(1 + (1 + 16))] = 5respectively. Thus, the right-shifter of the split-path circuit has thesame delay as the single shifter, but the split-path circuit has anadditional multiplexer as well. For the conversion of signed numberswith a RTN rounding mode, the mantissa is preferably negated prior to bebeing shifted to ensure maximum accuracy in the rounded result. In thiscase, the negation of the mantissa may limit the speed of the conversionof the number to fixed point format. This provides time to compute theshift offset, and because the single shifter is typically smaller thanthe total size of the split-path shifters, the single shifter circuitmay reduce the hardware requirements in these cases.

Example circuits have been described herein for converting a binarynumber in floating point format to fixed point format. In theseexamples, specific values have been assigned to the floating point andfixed point formats (integer width, fractional width etc.). It will beappreciated that this was for the purpose of illustration only, and thatthe circuits described herein are capable of converting numbers ofvarious floating point formats to various fixed point formats. Thefloating point format may for example be 32-bit single precision, or64-bit double precision in accordance with the IEEE 754 standard. Thenumbers (in floating point and/or fixed point format) may be signed orunsigned.

The examples described herein illustrate how the significand may beformatted prior to being shifted. The formatting may be performed by aformatting unit forming part of the binary logic circuit (as in some ofthe examples described herein), but it will be appreciated that theformatting may be performed by one or more components separate to thebinary logic circuit. In such cases the (formatted) mantissa/significand inputs to the binary logic circuit may be received directlyby the shifters.

The examples described herein use the terminology ‘left-shift’ and‘right-shift’. These terms have been used to denote a direction in whicha binary string is shifted by a shifter. These terms have been usedwithin the context of a conventional binary logic system in which abinary string is read left to right; i.e. the most significant bits ofthe string are left-most bits, and the least significant bits of thestring are the right-most bits. It will be appreciated that the term‘left-shift’ has been used to denote that the input is shifted in adirection towards the most significant bit, and the term ‘right-shift’has been used to denote that an input that is shifted in a directiontowards the lest significant bit.

The logic circuits of FIGS. 4-10 are shown as comprising a number offunctional blocks. This is schematic only and is not intended to definea strict division between different logic elements of such entities.Each functional block may be provided in any suitable manner. It is tobe understood that intermediate values described herein as being formedby a unit, or shifter need not be physically generated by the unit orshifter at any point and may merely represent logical values whichconveniently describe the processing performed by the unit or shifterbetween its input and output.

Generally, any of the functions, methods, techniques or componentsdescribed above can be implemented in software, firmware, hardware(e.g., fixed logic circuitry), or any combination thereof. The terms“module,” “functionality,” “component”, “element”, “unit”, “block” and“logic” may be used herein to generally represent software, firmware,hardware, or any combination thereof. In the case of a softwareimplementation, the module, functionality, component, element, unit,block or logic represents program code that performs the specified taskswhen executed on a processor. The algorithms and methods describedherein could be performed by one or more processors executing code thatcauses the processor(s) to perform the algorithms/methods. Examples of acomputer-readable storage medium include a random-access memory (RAM),read-only memory (ROM), an optical disc, flash memory, hard disk memory,and other memory devices that may use magnetic, optical, and othertechniques to store instructions or other data and that can be accessedby a machine.

The terms computer program code and computer readable instructions asused herein refer to any kind of executable code for processors,including code expressed in a machine language, an interpreted languageor a scripting language. Executable code includes binary code, machinecode, bytecode, code defining an integrated circuit (such as a hardwaredescription language or netlist), and code expressed in a programminglanguage code such as C, Java or OpenCL. Executable code may be, forexample, any kind of software, firmware, script, module or librarywhich, when suitably executed, processed, interpreted, compiled,executed at a virtual machine or other software environment, cause aprocessor of the computer system at which the executable code issupported to perform the tasks specified by the code.

A processor, computer, or computer system may be any kind of device,machine or dedicated circuit, or collection or portion thereof, withprocessing capability such that it can execute instructions. A processormay be any kind of general purpose or dedicated processor, such as aCPU, GPU, System-on-chip, state machine, media processor, anapplication-specific integrated circuit (ASIC), a programmable logicarray, a field-programmable gate array (FPGA), or the like. A computeror computer system may comprise one or more processors.

It is also intended to encompass software which defines a configurationof hardware as described herein, such as HDL (hardware descriptionlanguage) software, as is used for designing integrated circuits, or forconfiguring programmable chips, to carry out desired functions. That is,there may be provided a computer readable storage medium having encodedthereon computer readable program code in the form of an integratedcircuit definition dataset that when processed in an integrated circuitmanufacturing system configures the system to manufacture a binary logiccircuit configured to perform any of the methods described herein, or tomanufacture a binary logic circuit comprising any apparatus describedherein.

An integrated circuit definition dataset may be in the form of computercode, for example as a netlist, code for configuring a programmablechip, as a hardware description language defining an integrated circuitat any level, including as register transfer level (RTL) code, ashigh-level circuit representations such as Verilog or VHDL, and aslow-level circuit representations such as OASIS and GDSII. Higher levelrepresentations which logically define an integrated circuit (such asRTL) may be processed at a computer system configured for generating amanufacturing definition of an integrated circuit in the context of asoftware environment comprising definitions of circuit elements andrules for combining those elements in order to generate themanufacturing definition of an integrated circuit so defined by therepresentation. As is typically the case with software executing at acomputer system so as to define a machine, one or more intermediate usersteps (e.g. providing commands, variables etc.) may be required in orderfor a computer system configured for generating a manufacturingdefinition of an integrated circuit to execute code defining anintegrated circuit so as to generate the manufacturing definition ofthat integrated circuit.

An example of processing an integrated circuit definition dataset at anintegrated circuit manufacturing system so as to configure the system tomanufacture a binary logic circuit will now be described with respect toFIG. 11 .

FIG. 11 shows an example of an integrated circuit (IC) manufacturingsystem 1102 which comprises a layout processing system 1104 and anintegrated circuit generation system 1106. The IC manufacturing system1102 is configured to receive an IC definition dataset (e.g. defining alogic circuit as described in any of the examples herein), process theIC definition dataset, and generate an IC according to the IC definitiondataset (e.g. which embodies a binary logic circuit as described in anyof the examples herein). The processing of the IC definition datasetconfigures the IC manufacturing system 1102 to manufacture an integratedcircuit embodying a binary logic circuit as described in any of theexamples herein.

The layout processing system 1104 is configured to receive and processthe IC definition dataset to determine a circuit layout. Methods ofdetermining a circuit layout from an IC definition dataset are known inthe art, and for example may involve synthesising RTL code to determinea gate level representation of a circuit to be generated, e.g. in termsof logical components (e.g. NAND, NOR, AND, OR, MUX and FLIP-FLOPcomponents). A circuit layout can be determined from the gate levelrepresentation of the circuit by determining positional information forthe logical components. This may be done automatically or with userinvolvement in order to optimise the circuit layout. When the layoutprocessing system 1104 has determined the circuit layout it may output acircuit layout definition to the IC generation system 1106.

The IC generation system 1106 generates an IC according to the circuitlayout definition, as is known in the art. For example, the ICgeneration system 1106 may implement a semiconductor device fabricationprocess to generate the IC, which may involve a multiple-step sequenceof photo lithographic and chemical processing steps during whichelectronic circuits are gradually created on a wafer made ofsemiconducting material. The circuit layout definition may be in theform of a mask which can be used in a lithographic process forgenerating an IC according to the circuit definition. Alternatively, thecircuit layout definition provided to the IC generation system 1106 maybe in the form of computer-readable code which the IC generation system1106 can use to form a suitable mask for use in generating an IC.

The different processes performed by the IC manufacturing system 1102may be implemented all in one location, e.g. by one party.Alternatively, the IC manufacturing system 1102 may be a distributedsystem such that some of the processes may be performed at differentlocations, and may be performed by different parties. For example, someof the stages of: (i) synthesising RTL code representing the ICdefinition dataset to form a gate level representation of a circuit tobe generated, (ii) generating a circuit layout based on the gate levelrepresentation, (iii) forming a mask in accordance with the circuitlayout, and (iv) fabricating an integrated circuit using the mask, maybe performed in different locations and/or by different parties.

In other examples, processing of the integrated circuit definitiondataset at an integrated circuit manufacturing system may configure thesystem to manufacture a binary logic circuit without the IC definitiondataset being processed so as to determine a circuit layout. Forinstance, an integrated circuit definition dataset may define theconfiguration of a reconfigurable processor, such as an FPGA, and theprocessing of that dataset may configure an IC manufacturing system togenerate a reconfigurable processor having that defined configuration(e.g. by loading configuration data to the FPGA).

In some embodiments, an integrated circuit manufacturing definitiondataset, when processed in an integrated circuit manufacturing system,may cause an integrated circuit manufacturing system to generate adevice as described herein. For example, the configuration of anintegrated circuit manufacturing system in the manner described abovewith respect to FIG. 11 by an integrated circuit manufacturingdefinition dataset may cause a device as described herein to bemanufactured.

In some examples, an integrated circuit definition dataset could includesoftware which runs on hardware defined at the dataset or in combinationwith hardware defined at the dataset. In the example shown in FIG. 11 ,the IC generation system may further be configured by an integratedcircuit definition dataset to, on manufacturing an integrated circuit,load firmware onto that integrated circuit in accordance with programcode defined at the integrated circuit definition dataset or otherwiseprovide program code with the integrated circuit for use with theintegrated circuit.

The applicant hereby discloses in isolation each individual featuredescribed herein and any combination of two or more such features, tothe extent that such features or combinations are capable of beingcarried out based on the present specification as a whole in the lightof the common general knowledge of a person skilled in the art,irrespective of whether such features or combinations of features solveany problems disclosed herein, and without limitation to the scope ofthe claims. The applicant indicates that aspects of the presentinvention may consist of any such individual feature or combination offeatures. In view of the foregoing description it will be evident to aperson skilled in the art that various modifications may be made withinthe scope of the invention.

What is claimed is:
 1. A binary logic circuit for converting a number infloating point format having an exponent E of ew bits, an exponent biasB given by B = 2^(ew-1) - 1, and a significand comprising a mantissa Mof mw bits into a fixed point format with an integer width of iw bitsand a fractional width of fw bits, the binary logic circuit comprising:a shifter operable to receive a significand input comprising acontiguous set of the most significant bits of the significand andconfigured to left-shift the significand input by a number of bits equalto the value represented by k least significant bits of the exponent togenerate a shifter output, wherein k is dependent on the integer widthiw or the fractional width fw; and a multiplexer coupled to the shifterand configured to: receive an input comprising a contiguous set of bitsof the shifter output; and output the input if the most significant bitof the exponent is equal to one.
 2. The binary logic circuit as claimedin claim 1, wherein the binary logic circuit further comprises aformatting hardware circuit coupled to the shifter, the formattinghardware circuit configured to receive as an input a string comprisingthe mw mantissa bits and to format the string to generate thesignificand input to the shifter.
 3. The binary logic circuit as claimedin claim 2, wherein the formatting hardware circuit is configured toperform one or more formatting operations comprising appending(iw-2-s_(y)) bits to the most significant bit of the significand, wheres_(y) = 0 and the appended bits are zero bits for an unsigned floatingpoint number, and s_(y) = 1 and the appended bits are sign bits for asigned floating point number.
 4. The binary logic circuit as claimed inclaim 1, wherein the input of the multiplexer is equal to the shifteroutput.
 5. The binary logic circuit as claimed in claim 1, wherein theshifter has a bit width equal to iw″ + min(mw,(fw+iw″)), where iw″ =min{(iw-2-s_(y)), 2^(ew-1)-2}, wherein s_(y) = 1 for a signed floatingpoint number and s_(y) = 0 for an unsigned floating point number.
 6. Thebinary logic circuit as claimed in claim 2, wherein the formattinghardware circuit is configured to perform one or more formattingoperations comprising appending (iw-1-s_(y)) bits to the mostsignificant bit of the significand, where s_(y) = 0 and the appendedbits are zero bits for an unsigned floating point number, and s_(y) = 1and the appended bits are sign bits for a signed floating point number.7. The binary logic circuit as claimed in claim 1, further comprising acorrection hardware circuit coupled to the shifter and the multiplexer,the correction hardware circuit being configured to receive the shifteroutput and to discard its most significant bit and append a zero-bit toits least significant bit to form the input to the multiplexer.
 8. Thebinary logic circuit as claimed in claim 1, wherein the shifter has abit width equal to iw′ + min(mw, (fw+iw′)), where iw′ =min{(iw-1-s_(y)), 2^(ew-1)-1}, wherein s_(y) = 1 for a signed floatingpoint number and s_(y) = 0 for an unsigned floating point number.
 9. Thebinary logic circuit as claimed in claim 2, wherein the formattinghardware circuit is further configured to truncate a set of leastsignificant bits of the mw mantissa bits that would not form part of thefw bits of the fixed point format if left-shifted by a value equal tothe shift range of the shifter.
 10. The binary logic circuit as claimedin claim 1, wherein the shifter has a shift range limited to the minimumof: i) iw-2-s_(y); and ii) 2^(ew-1)-2, wherein s_(y) = 1 for a signedfloating point number and s_(y) = 0 for an unsigned floating pointnumber.
 11. The binary logic circuit as claimed in claim 1, wherein thefloating point format and fixed point format are such that (iw-s_(y)-1)< 2^(ew-1)-1, and k is equal to the bit width of the value (iw-s_(y)-2);or the floating point format and fixed point format are such that2^(ew-1)-1 ≤ (iw-s_(y)-1), and k= ew-1, where s_(y)=1 for a signedfloating point number and s_(y)=0 for an unsigned floating point number.12. The binary logic circuit as claimed in claim 1, wherein the binarylogic circuit further comprises an inverting hardware circuit configuredto invert the bit values of the exponent; and an additional shiftercoupled to the inverting hardware circuit configured to receive anadditional significand input comprising a contiguous set of the mostsignificant bits of the significand and configured to right-shift theadditional significand input by a number of bits equal to the valuerepresented by the p least significant bits of the inverted exponent togenerate an additional shifter output, wherein p is dependent on theinteger width iw or the fractional width fw.
 13. The binary logiccircuit as claimed in claim 12, further comprising an additionalformatting hardware circuit coupled to the additional shifter, theadditional formatting hardware circuit configured to receive as an inputa string comprising the mw mantissa bits and to format the string togenerate the additional significand input to the additional shifter. 14.The binary logic circuit as claimed in claim 12, wherein the additionalshifter has a bit width equal to: (1+s_(y)) + min(fw, mw + 2^(ew-1) -2), wherein s_(y) = 1 for a signed floating point number and s_(y) = 0for an unsigned floating point number.
 15. The binary logic circuit asclaimed in claim 12, wherein the additional shifter has a shift rangelimited to the minimum of: i) 2^(ew-)1-2; and ii) fw.
 16. The binarylogic circuit as claimed in claim 12, further comprising a furtherformatting hardware circuit coupled to the additional shifter, thefurther formatting hardware circuit being configured to append(iw-1-s_(y)) bits to the most significant bit of the additional shifteroutput, where s_(y) = 0 and the appended bits are zero bits for anunsigned floating point number, and s_(y) = 1 and the appended bits aresign bits for a signed floating point number.
 17. The binary logiccircuit as claimed in claim 12, wherein the floating point format andfixed point format are such that fw < 2^(ew-1)-1 and p is equal to thebit width to represent fw; or the floating point and fixed point numbersare such that fw ≥ 2^(ew-1)-1 and p = ew-1.
 18. The binary logic circuitas claimed in claim 1, wherein the binary logic circuit furthercomprises exception-handling circuitry configured to output an exceptionresult in response to detecting an exception condition from a set ofexception conditions comprising at least one of: i) E > B + iw -1 -s_(y); ii) E < B - fw, where s_(y) = 1 for a signed number and s_(y)=0for an unsigned number; and the binary logic circuit further comprisesan output multiplexer configured to multiplex between the exceptionresult and the output from the multiplexer coupled to the shifter.
 19. Amethod of converting a number in floating point format having anexponent E of ew bits, an exponent bias B given by B = 2^(ew-1) - 1, anda significand comprising a mantissa M of mw bits into a fixed pointformat with an integer width of iw bits and a fractional width of fwbits, the method comprising: receiving at a shifter a significand inputcomprising a contiguous set of the most significant bits of thesignificand and left-shifting the significand input by a number of bitsequal to the value represented by k least significant bits of theexponent to generate a shifter output, wherein k is dependent on theinteger width iw or the fractional width fw; and receiving at amultiplexer an input comprising a contiguous set of bits of the shifteroutput and outputting the input if the most significant bit of theexponent is equal to one.
 20. A non-transitory computer readable storagemedium having stored thereon a computer readable description of a binarylogic circuit for converting a number in floating point format having anexponent E of ew bits, an exponent bias B given by B = 2^(ew-1) - 1, anda significand comprising a mantissa M of mw bits into a fixed pointformat with an integer width of iw bits and a fractional width of fwbits that, when processed in an integrated circuit manufacturing system,causes the integrated circuit manufacturing system to manufacture anintegrated circuit embodying the binary logic circuit, the binary logiccircuit comprising: a shifter operable to receive a significand inputcomprising a contiguous set of the most significant bits of thesignificand and configured to left-shift the significand input by anumber of bits equal to the value represented by k least significantbits of the exponent to generate a shifter output, wherein k isdependent on the integer width iw or the fractional width fw; and amultiplexer coupled to the shifter and configured to: receive an inputcomprising a contiguous set of bits of the shifter output; and outputthe input if the most significant bit of the exponent is equal to one.